home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / edit / thesrc20.zip / commset1.c < prev    next >
C/C++ Source or Header  |  1995-01-26  |  88KB  |  2,840 lines

  1. /***********************************************************************/
  2. /* COMMSET1.C - SET commands A-N                                       */
  3. /***********************************************************************/
  4. /*
  5.  * THE - The Hessling Editor. A text editor similar to VM/CMS xedit.
  6.  * Copyright (C) 1991-1995 Mark Hessling
  7.  *
  8.  * This program is free software; you can redistribute it and/or
  9.  * modify it under the terms of the GNU General Public License as
  10.  * published by the Free Software Foundation; either version 2 of
  11.  * the License, or any later version.
  12.  *
  13.  * This program is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16.  * General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU General Public License
  19.  * along with this program; if not, write to:
  20.  *
  21.  *    The Free Software Foundation, Inc.
  22.  *    675 Mass Ave,
  23.  *    Cambridge, MA 02139 USA.
  24.  *
  25.  *
  26.  * If you make modifications to this software that you feel increases
  27.  * it usefulness for the rest of the community, please email the
  28.  * changes, enhancements, bug fixes as well as any and all ideas to me.
  29.  * This software is going to be maintained and enhanced as deemed
  30.  * necessary by the community.
  31.  *
  32.  * Mark Hessling                     email: M.Hessling@gu.edu.au
  33.  * 36 David Road                     Phone: +61 7 849 7731
  34.  * Holland Park                      Fax:   +61 7 875 5314
  35.  * QLD 4121
  36.  * Australia
  37.  */
  38.  
  39. /*
  40. $Id: commset1.c 2.0 1995/01/26 16:30:08 MH Release MH $
  41. */
  42.  
  43. #include <stdio.h>
  44.  
  45. #include "the.h"
  46. #include "proto.h"
  47.  
  48. /*#define DEBUG 1*/
  49. /*man-start*********************************************************************
  50.  
  51.  
  52.  
  53. ========================================================================
  54. SET COMMAND REFERENCE
  55. ========================================================================
  56. **man-end**********************************************************************/
  57.  
  58. /*man-start*********************************************************************
  59. COMMAND
  60.      arbchar - set arbitrary character(s) for targets
  61.  
  62. SYNTAX
  63.      [SET] ARBchar ON|OFF [char1] [char2]
  64.  
  65. DESCRIPTION
  66.      Set the character to use as an 'arbitrary character' in string
  67.      targets. The first arbitrary character matches a group of zero
  68.      or more characters, the second will match exactly one character.
  69.  
  70. COMPATIBILITY
  71.      XEDIT: Compatible.
  72.             Single arbitrary character not supported.
  73.      KEDIT: Compatible.
  74.  
  75. DEFAULT
  76.      OFF $ ?
  77.  
  78. STATUS
  79.      Multiple arbitrary character matching is not implemented.
  80. **man-end**********************************************************************/
  81. #ifdef PROTO
  82. short Arbchar(CHARTYPE *params)
  83. #else
  84. short Arbchar(params)
  85. CHARTYPE *params;
  86. #endif
  87. /***********************************************************************/
  88. {
  89. /*------------------------- external data -----------------------------*/
  90. /*--------------------------- local data ------------------------------*/
  91. #define ARB_PARAMS  4
  92.  CHARTYPE *word[ARB_PARAMS+1];
  93.  unsigned short num_params=0;
  94.  short rc=RC_INVALID_OPERAND;
  95.  bool arbsts=CURRENT_VIEW->arbchar_status;
  96.  CHARTYPE arbchr_single=CURRENT_VIEW->arbchar_single;
  97.  CHARTYPE arbchr_multiple=CURRENT_VIEW->arbchar_multiple;
  98. /*--------------------------- processing ------------------------------*/
  99. #ifdef TRACE
  100.  trace_function("commset1.c:Arbchar");
  101. #endif
  102. /*---------------------------------------------------------------------*/
  103. /* Validate the parameters that have been supplied.                    */
  104. /*---------------------------------------------------------------------*/
  105.  num_params = param_split(params,word,ARB_PARAMS,WORD_DELIMS,TEMP_PARAM);
  106.  switch(num_params)
  107.    {
  108. /*---------------------------------------------------------------------*/
  109. /* No parameters, error.                                               */
  110. /*---------------------------------------------------------------------*/
  111.     case 0: 
  112.          display_error(3,(CHARTYPE *)"",FALSE); 
  113.          break;
  114. /*---------------------------------------------------------------------*/
  115. /* 1 or 2 parameters, validate them...                                 */
  116. /*---------------------------------------------------------------------*/
  117.     case 1: 
  118.          rc = execute_set_on_off(word[0],&arbsts);
  119.          if (rc != RC_OK)
  120.             break;
  121.     case 2: 
  122.     case 3:
  123.          rc = execute_set_on_off(word[0],&arbsts);
  124.          if (rc != RC_OK)
  125.             break;
  126.          rc = RC_INVALID_OPERAND;
  127. /*---------------------------------------------------------------------*/
  128. /* For 2 parameters, check that a single character has been supplied...*/
  129. /*---------------------------------------------------------------------*/
  130.          if (strlen(word[1]) != 1)
  131.            {
  132.             display_error(1,word[1],FALSE);
  133.             break;
  134.            }
  135.          arbchr_multiple = word[1][0];
  136.          rc = RC_OK;
  137. /*---------------------------------------------------------------------*/
  138. /* For 2 parameters, don't check any more.                             */
  139. /*---------------------------------------------------------------------*/
  140.          if (num_params == 2)
  141.             break;
  142.          rc = RC_INVALID_OPERAND;
  143. /*---------------------------------------------------------------------*/
  144. /* For 3 parameters, check that a single character has been supplied...*/
  145. /*---------------------------------------------------------------------*/
  146.          if (strlen(word[2]) != 1)
  147.            {
  148.             display_error(1,word[2],FALSE);
  149.             break;
  150.            }
  151.          arbchr_single = word[2][0];
  152.          rc = RC_OK;
  153.          break;
  154. /*---------------------------------------------------------------------*/
  155. /* Too many parameters...                                              */
  156. /*---------------------------------------------------------------------*/
  157.     default:
  158.          display_error(2,(CHARTYPE *)"",FALSE); 
  159.          break;
  160.    }
  161. /*---------------------------------------------------------------------*/
  162. /* If valid parameters, change the settings...                         */
  163. /*---------------------------------------------------------------------*/
  164.  if (rc == RC_OK)
  165.    {
  166.     CURRENT_VIEW->arbchar_single = arbchr_single;
  167.     CURRENT_VIEW->arbchar_multiple = arbchr_multiple;
  168.     CURRENT_VIEW->arbchar_status = arbsts;
  169.    }
  170. #ifdef TRACE
  171.  trace_return();
  172. #endif
  173.  return(rc);
  174. }
  175. /*man-start*********************************************************************
  176. COMMAND
  177.      autosave - set autosave period
  178.  
  179. SYNTAX
  180.      [SET] AUtosave n|OFF
  181.  
  182. DESCRIPTION
  183.      The AUTOSAVE command sets the interval between automatic saves
  184.      of the file, or turns it off altogether.
  185.  
  186. COMPATIBILITY
  187.      XEDIT: Does not support [mode] option.
  188.      KEDIT: Compatible.
  189.  
  190. DEFAULT
  191.      OFF
  192.  
  193. STATUS
  194.      Complete.
  195. **man-end**********************************************************************/
  196. #ifdef PROTO
  197. short Autosave(CHARTYPE *params)
  198. #else
  199. short Autosave(params)
  200. CHARTYPE *params;
  201. #endif
  202. /***********************************************************************/
  203. {
  204. /*------------------------- external data -----------------------------*/
  205.  extern CHARTYPE AUSx;
  206. /*--------------------------- local data ------------------------------*/
  207. #define AUS_PARAMS  1
  208.  CHARTYPE *word[AUS_PARAMS+1];
  209.  unsigned short num_params=0;
  210. /*--------------------------- processing ------------------------------*/
  211. #ifdef TRACE
  212.  trace_function("commset1.c:Autosave");
  213. #endif
  214.  num_params = param_split(params,word,AUS_PARAMS,WORD_DELIMS,TEMP_PARAM);
  215.  if (num_params == 0)
  216.    {
  217.     display_error(3,(CHARTYPE *)"",FALSE);
  218. #ifdef TRACE
  219.     trace_return();
  220. #endif
  221.     return(RC_INVALID_OPERAND);
  222.    }
  223.  if (num_params != 1)
  224.    {
  225.     display_error(2,(CHARTYPE *)"",FALSE);
  226. #ifdef TRACE
  227.     trace_return();
  228. #endif
  229.     return(RC_INVALID_OPERAND);
  230.    }
  231.  if (equal((CHARTYPE *)"off",word[0],3))
  232.    {
  233.     CURRENT_FILE->autosave = 0;
  234. #ifdef TRACE
  235.     trace_return();
  236. #endif
  237.     return(RC_OK);
  238.    }
  239.  if (!valid_positive_integer(word[0]))
  240.    {
  241.     display_error(4,(CHARTYPE *)word[0],FALSE);
  242. #ifdef TRACE
  243.     trace_return();
  244. #endif
  245.     return(RC_INVALID_OPERAND);
  246.    }
  247.  CURRENT_FILE->autosave = (CHARTYPE)atoi(word[0]);
  248.  return(RC_OK);
  249. }
  250. /*man-start*********************************************************************
  251. COMMAND
  252.      backup - indicate if a backup copy of the file is to be kept
  253.  
  254. SYNTAX
  255.      [SET] BACKup OFF|TEMP|KEEP|ON
  256.  
  257. DESCRIPTION
  258.      The BACKUP command allows the user to determine if a backup copy
  259.      of the original file is to be kept when the file being edited is
  260.      saved or filed.
  261.  
  262.      BACKUP KEEP and BACKUP ON are the same. BACKUP ON is kept for
  263.      compatability with previous versions of THE.
  264.  
  265.      With BACKUP OFF, the file being written to disk will replace an
  266.      existing file. There is a chance that you will end up with neither
  267.      the old version of the file or the new one if problems occur
  268.      while the file is being written.
  269.  
  270.      With BACKUP TEMP or KEEP, the file being written is first renamed
  271.      to the filename with a .bak extension. The file in memory is 
  272.      then written to disk. If BACKUP TEMP is in effect, the backup
  273.      file is then deleted.
  274.  
  275. COMPATIBILITY
  276.      XEDIT: N/A
  277.      KEDIT: Compatible.
  278.  
  279. DEFAULT
  280.      KEEP
  281.  
  282. SEE ALSO
  283.      FILE, FFILE, SAVE, SSAVE
  284.  
  285. STATUS
  286.      Complete.
  287. **man-end**********************************************************************/
  288. #ifdef PROTO
  289. short Backup(CHARTYPE *params)
  290. #else
  291. short Backup(params)
  292. CHARTYPE *params;
  293. #endif
  294. /***********************************************************************/
  295. {
  296. /*------------------------- external data -----------------------------*/
  297. /*--------------------------- local data ------------------------------*/
  298.  short rc=RC_OK;
  299.  short backup_type=0;
  300. /*--------------------------- processing ------------------------------*/
  301. #ifdef TRACE
  302.  trace_function("commset1.c:Backup");
  303. #endif
  304.  if (equal((CHARTYPE *)"off",params,3))
  305.     backup_type = BACKUP_OFF;
  306.  if (equal((CHARTYPE *)"on",params,2))
  307.     backup_type = BACKUP_ON;
  308.  if (equal((CHARTYPE *)"keep",params,4))
  309.     backup_type = BACKUP_KEEP;
  310.  if (equal((CHARTYPE *)"temp",params,4))
  311.     backup_type = BACKUP_TEMP;
  312.  if (backup_type == 0)
  313.    {
  314.     display_error(1,params,FALSE);
  315. #ifdef TRACE
  316.     trace_return();
  317. #endif
  318.     return(RC_INVALID_OPERAND);
  319.    }
  320.  CURRENT_FILE->backup = backup_type;
  321. #ifdef TRACE
  322.  trace_return();
  323. #endif
  324.  return(rc);
  325. }
  326. /*man-start*********************************************************************
  327. COMMAND
  328.      beep - turn on or off the audible alarm when displaying errors
  329.  
  330. SYNTAX
  331.      [SET] BEEP ON|OFF
  332.  
  333. DESCRIPTION
  334.      The BEEP command allows the user to determine if an audible alarm
  335.      is sounded when an error is displayed.
  336.  
  337. COMPATIBILITY
  338.      XEDIT: N/A
  339.      KEDIT: Compatible.
  340.  
  341. DEFAULT
  342.      OFF
  343.  
  344. STATUS
  345.      Complete.
  346. **man-end**********************************************************************/
  347. #ifdef PROTO
  348. short BeepSound(CHARTYPE *params)
  349. #else
  350. short BeepSound(params)
  351. CHARTYPE *params;
  352. #endif
  353. /***********************************************************************/
  354. {
  355. /*-------------------------- external data ----------------------------*/
  356.  extern bool BEEPx;
  357. /*--------------------------- local data ------------------------------*/
  358.  short rc=RC_OK;
  359. /*--------------------------- processing ------------------------------*/
  360. #ifdef TRACE
  361.  trace_function("commset1.c:BeepSound");
  362. #endif
  363.  rc = execute_set_on_off(params,&BEEPx);
  364. #ifdef TRACE
  365.  trace_return();
  366. #endif
  367.  return(rc);
  368. }
  369. /*man-start*********************************************************************
  370. COMMAND
  371.      case - set case sensitivity parameters
  372.  
  373. SYNTAX
  374.      [SET] CASE Mixed|Lower|Upper [Respect|Ignore] [Respect|Ignore] 
  375.                 [Respect|Ignore]
  376.  
  377. DESCRIPTION
  378.      The CASE command sets the editor's handling of the case of text.
  379.  
  380.      The first option (which is mandatory) controls how text is entered
  381.      by the user. When LOWER or UPPER are in effect, the shift or caps
  382.      lock keys have no effect on the text being entered. When MIXED is
  383.      in effect, text is entered in the case set by the use of the shift
  384.      and caps lock keys.
  385.  
  386.      The second option determines how the editor determines if a string
  387.      target matches text in the file when the target is used in a LOCATE
  388.      command.  With IGNORE in effect, a match is
  389.      found irrespective of the case of the target or the found text.
  390.      The following strings are treated as equivalent: the THE The ThE...
  391.      With RESPECT in effect, the target and text must be the same case.
  392.      Therefore a target of 'The' only matches text containing 'The', not
  393.      'THE' or 'ThE' etc.
  394.  
  395.      The third option determines how the editor determines if a string
  396.      target matches text in the file when the target is used in a CHANGE
  397.      command.  With IGNORE in effect, a match is
  398.      found irrespective of the case of the target or the found text.
  399.      The following strings are treated as equivalent: the THE The ThE...
  400.      With RESPECT in effect, the target and text must be the same case.
  401.      Therefore a target of 'The' only matches text containing 'The', not
  402.      'THE' or 'ThE' etc.
  403.  
  404.      The fourth option determines how the editor determines the sort 
  405.      order of upper and lower case with the SORT command.
  406.      With IGNORE in effect, upper and lower case letters are treated as
  407.      equivalent.
  408.      With RESPECT in effect, upper and lower case letters are treated as
  409.      different values and uppercase characters will sort before lowercase
  410.      characters.
  411.  
  412. COMPATIBILITY
  413.      XEDIT: Adds support for case significance in CHANGE commands.
  414.      KEDIT: Adds support for LOWER option.
  415.      Both:  Adds support for case significance in SORT command.
  416.  
  417. DEFAULT
  418.      MIXED IGNORE RESPECT RESPECT
  419.  
  420. STATUS
  421.      Complete
  422. **man-end**********************************************************************/
  423. #ifdef PROTO
  424. short Case(CHARTYPE *params)
  425. #else
  426. short Case(params)
  427. CHARTYPE *params;
  428. #endif
  429. /***********************************************************************/
  430. {
  431. /*------------------------- external data -----------------------------*/
  432. /*--------------------------- local data ------------------------------*/
  433. #define CAS_PARAMS  4
  434.  CHARTYPE parm[CAS_PARAMS];
  435.  CHARTYPE *word[CAS_PARAMS+1];
  436.  register short i=0;
  437.  unsigned short num_params=0;
  438. /*--------------------------- processing ------------------------------*/
  439. #ifdef TRACE
  440.  trace_function("commset1.c:Case");
  441. #endif
  442.  num_params = param_split(params,word,CAS_PARAMS,WORD_DELIMS,TEMP_PARAM);
  443. /*---------------------------------------------------------------------*/
  444. /* Validate the first parameter: must be Mixed, Upper or Lower         */
  445. /*---------------------------------------------------------------------*/
  446.  parm[0] = (CHARTYPE)UNDEFINED_OPERAND;
  447.  if (equal((CHARTYPE *)"mixed",word[0],1))
  448.     parm[0] = CASE_MIXED;
  449.  if (equal((CHARTYPE *)"upper",word[0],1))
  450.     parm[0] = CASE_UPPER;
  451.  if (equal((CHARTYPE *)"lower",word[0],1))
  452.     parm[0] = CASE_LOWER;
  453.  if (parm[0] == (CHARTYPE)UNDEFINED_OPERAND)
  454.     {
  455.      display_error(1,(CHARTYPE *)word[0],FALSE);
  456. #ifdef TRACE
  457.      trace_return();
  458. #endif
  459.      return(RC_INVALID_OPERAND);
  460.     }
  461. /*---------------------------------------------------------------------*/
  462. /* Save the current values of each remaining case setting.             */
  463. /*---------------------------------------------------------------------*/
  464.  parm[1] = CURRENT_VIEW->case_locate;
  465.  parm[2] = CURRENT_VIEW->case_change;
  466.  parm[3] = CURRENT_VIEW->case_sort;
  467. /*---------------------------------------------------------------------*/
  468. /* Validate the remainder of the arguments.                            */
  469. /* Each must be Respect or Ignore, if present.                         */
  470. /*---------------------------------------------------------------------*/
  471.  for (i=1;i<num_params;i++)
  472.    {
  473.     if (strcmp(word[1],"") != 0)
  474.       {
  475.        if (equal((CHARTYPE *)"respect",word[i],1))
  476.           parm[i] = CASE_RESPECT;
  477.        else
  478.           if (equal((CHARTYPE *)"ignore",word[i],1))
  479.              parm[i] = CASE_IGNORE;
  480.           else
  481.             {
  482.              display_error(1,(CHARTYPE *)word[i],FALSE);
  483. #ifdef TRACE
  484.              trace_return();
  485. #endif
  486.              return(RC_INVALID_OPERAND);
  487.             }
  488.       }
  489.    }
  490. /*---------------------------------------------------------------------*/
  491. /* Set the new values of case settings for the view.                   */
  492. /*---------------------------------------------------------------------*/
  493.  CURRENT_VIEW->case_enter  = parm[0];
  494.  CURRENT_VIEW->case_locate = parm[1];
  495.  CURRENT_VIEW->case_change = parm[2];
  496.  CURRENT_VIEW->case_sort   = parm[3];
  497.  
  498. #ifdef TRACE
  499.  trace_return();
  500. #endif
  501.  return(RC_OK);
  502. }
  503. /*man-start*********************************************************************
  504. COMMAND
  505.      clearscreen - indicate if the screen is to be cleared on exit
  506.  
  507. SYNTAX
  508.      [SET] CLEARScreen ON|OFF
  509.  
  510. DESCRIPTION
  511.      The CLEARSCREEN command allows the user to request that the 
  512.      screen be cleared on exit from THE.
  513.  
  514. COMPATIBILITY
  515.      XEDIT: N/A
  516.      KEDIT: N/A
  517.  
  518. DEFAULT
  519.      OFF
  520.  
  521. STATUS
  522.      Complete
  523. **man-end**********************************************************************/
  524. #ifdef PROTO
  525. short Clearscreen(CHARTYPE *params)
  526. #else
  527. short Clearscreen(params)
  528. CHARTYPE *params;
  529. #endif
  530. /***********************************************************************/
  531. {
  532. /*-------------------------- external data ----------------------------*/
  533.  extern bool CLEARSCREENx;
  534. /*--------------------------- local data ------------------------------*/
  535.  short rc=RC_OK;
  536. /*--------------------------- processing ------------------------------*/
  537. #ifdef TRACE
  538.  trace_function("commset1.c:Clearscreen");
  539. #endif
  540.  rc = execute_set_on_off(params,&CLEARSCREENx);
  541. #ifdef TRACE
  542.  trace_return();
  543. #endif
  544.  return(rc);
  545. }
  546. /*man-start*********************************************************************
  547. COMMAND
  548.      clock - turn on or off display of time on status line
  549.  
  550. SYNTAX
  551.      [SET] CLOCK ON|OFF
  552.  
  553. DESCRIPTION
  554.      The CLOCK command turns on or off the display of the time on the
  555.      status line.
  556.  
  557. COMPATIBILITY
  558.      XEDIT: N/A
  559.      KEDIT: Compatible.
  560.  
  561. DEFAULT
  562.      ON
  563.  
  564. STATUS
  565.      Complete
  566. **man-end**********************************************************************/
  567. #ifdef PROTO
  568. short Clock(CHARTYPE *params)
  569. #else
  570. short Clock(params)
  571. CHARTYPE *params;
  572. #endif
  573. /***********************************************************************/
  574. {
  575. /*-------------------------- external data ----------------------------*/
  576.  extern bool CLOCKx;
  577.  extern bool curses_started;
  578. /*--------------------------- local data ------------------------------*/
  579.  short rc=RC_OK;
  580. /*--------------------------- processing ------------------------------*/
  581. #ifdef TRACE
  582.  trace_function("commset1.c:Clock");
  583. #endif
  584.  rc = execute_set_on_off(params,&CLOCKx);
  585.  if (rc == RC_OK
  586.  &&  curses_started)
  587.     clear_footing();
  588. #ifdef TRACE
  589.  trace_return();
  590. #endif
  591.  return(rc);
  592. }
  593. /*man-start*********************************************************************
  594. COMMAND
  595.      cmdarrows - sets the behaviour of the up and down arrow keys
  596.  
  597. SYNTAX
  598.      [SET] CMDArrows Retrieve|Tab 
  599.  
  600. DESCRIPTION
  601.      The CMDARROWS command determines the action that occurs when the
  602.      up and down arrows keys are hit while on the command line.
  603.  
  604.      CMDARROWS RETRIEVE (the default) will set the up and down arrows 
  605.      to retrieve the last or next command entered on the command 
  606.      line.
  607.  
  608.      CMDARROWS TAB will set the up and down arrows to move to the last 
  609.      or first line respectively of the main window.
  610.  
  611. COMPATIBILITY
  612.      XEDIT: N/A
  613.      KEDIT: N/A
  614.  
  615. DEFAULT
  616.      RETRIEVE
  617.  
  618. SEE ALSO
  619.      CURSOR
  620.  
  621. STATUS
  622.      Complete.
  623. **man-end**********************************************************************/
  624. #ifdef PROTO
  625. short Cmdarrows(CHARTYPE *params)
  626. #else
  627. short Cmdarrows(params)
  628. CHARTYPE *params;
  629. #endif
  630. /***********************************************************************/
  631. {
  632. /*------------------------- external data -----------------------------*/
  633.  extern CHARTYPE CMDARROWSTABCMDx;
  634. /*--------------------------- local data ------------------------------*/
  635.  short rc=RC_OK;
  636. /*--------------------------- processing ------------------------------*/
  637. #ifdef TRACE
  638.  trace_function("commset1.c:Cmdarrows");
  639. #endif
  640. /*---------------------------------------------------------------------*/
  641. /* Determine values for first parameter; command line behaviour        */
  642. /*---------------------------------------------------------------------*/
  643.  if (equal("tab",params,1))
  644.     CMDARROWSTABCMDx = TRUE;
  645.  else
  646.    if (equal((CHARTYPE *)"retrieve",params,1))
  647.       CMDARROWSTABCMDx = FALSE;
  648.    else
  649.      {
  650.       display_error(1,params,FALSE);
  651.       rc = RC_INVALID_OPERAND;
  652.      }
  653. #ifdef TRACE
  654.  trace_return();
  655. #endif
  656.  return(rc);
  657. }
  658. /*man-start*********************************************************************
  659. COMMAND
  660.      cmdline - sets the position of the command line.
  661.  
  662. SYNTAX
  663.      [SET] CMDline ON|OFF|Top|Bottom
  664.  
  665. DESCRIPTION
  666.      The CMDLINE command sets the position of the command line, either
  667.      at the top of the screen, the bottom of the screen or off.
  668.  
  669. COMPATIBILITY
  670.      XEDIT: Compatible.
  671.             CMDLINE ON is equivalent to CMDLINE BOTTOM
  672.      KEDIT: Compatible. 
  673.  
  674. DEFAULT
  675.      BOTTOM
  676.  
  677. STATUS
  678.      Complete.
  679. **man-end**********************************************************************/
  680. #ifdef PROTO
  681. short Cmdline(CHARTYPE *params)
  682. #else
  683. short Cmdline(params)
  684. CHARTYPE *params;
  685. #endif
  686. /***********************************************************************/
  687. {
  688. /*------------------------- external data -----------------------------*/
  689.  extern CHARTYPE CMD_LINEx;
  690.  extern bool curses_started;
  691. /*--------------------------- local data ------------------------------*/
  692.  CHARTYPE cmd_place='?';
  693.  short off=0;
  694.  unsigned short y=0,x=0;
  695.  short rc=RC_OK;
  696. /*--------------------------- processing ------------------------------*/
  697. #ifdef TRACE
  698.  trace_function("commset1.c:Cmdline");
  699. #endif
  700.  if (equal((CHARTYPE *)"top",params,1))
  701.    {
  702.     cmd_place='T';
  703.     off = 1;
  704.    }
  705.  if (equal((CHARTYPE *)"bottom",params,1)
  706.  ||  equal((CHARTYPE *)"on",params,2))
  707.    {
  708.     cmd_place='B';
  709.     off = (-1);
  710.    }
  711.  if (equal((CHARTYPE *)"off",params,3))
  712.    {
  713.     cmd_place='O';
  714.     off = 0;
  715.    }
  716.  if (cmd_place=='?')
  717.    {
  718.     display_error(1,(CHARTYPE *)params,FALSE);
  719. #ifdef TRACE
  720.     trace_return();
  721. #endif
  722.     return(RC_INVALID_OPERAND);
  723.    }
  724. /*---------------------------------------------------------------------*/
  725. /* If the setting supplied is the same as the current setting, just    */
  726. /* return without doing anything.                                      */
  727. /*---------------------------------------------------------------------*/
  728.  if (cmd_place == CURRENT_VIEW->cmd_line)
  729.    {
  730. #ifdef TRACE
  731.     trace_return();
  732. #endif
  733.     return(RC_OK);
  734.    }
  735. /*---------------------------------------------------------------------*/
  736. /* Now we need to move the windows around.                             */
  737. /*---------------------------------------------------------------------*/
  738.  CURRENT_VIEW->cmd_line = cmd_place;
  739. /*---------------------------------------------------------------------*/
  740. /* Rebuild the windows and display...                                  */
  741. /*---------------------------------------------------------------------*/
  742.  set_screen_defaults();
  743.  if (curses_started)
  744.    {
  745.     if (set_up_windows(current_screen) != RC_OK)
  746.       {
  747. #ifdef TRACE
  748.        trace_return();
  749. #endif
  750.        return(rc);
  751.       }
  752.    }
  753.  if (CURRENT_VIEW->cmd_line == 'O')
  754.     CURRENT_VIEW->current_window = WINDOW_MAIN;
  755.  build_current_screen();
  756.  if (curses_started)
  757.     display_current_screen();
  758.  
  759. #ifdef TRACE
  760.  trace_return();
  761. #endif
  762.  return(rc);
  763. }
  764. /*man-start*********************************************************************
  765. COMMAND
  766.      colour - set colours for display
  767.  
  768. SYNTAX
  769.      [SET] COLOUR area [modifier[...]] [foreground background]
  770.      [SET] COLOR  area [modifier[...]] [foreground background]
  771.  
  772. DESCRIPTION
  773.      The COLOUR command changes the colours or display attributes of
  774.      various display areas in THE.
  775.  
  776.      Valid values for 'area':
  777.        Arrow    - command line prompt
  778.        Block    - marked block
  779.        CBlock   - current line if in marked block
  780.        Cmdline  - command line
  781.        CTofeof  - as above if the same as current line
  782.        CUrline  - the current line
  783.        Divider  - dividing line between vertical split screens
  784.        Filearea - area containing file lines
  785.        Idline   - line containing file specific info
  786.        Msgline  - error messages
  787.        Pending  - pending commands in prefix
  788.        PRefix   - prefix area
  789.        Reserved - any reserved lines
  790.        Scale    - line showing scale line
  791.        SHadow   - hidden line marker lines
  792.        STatarea - line showing status of editing session
  793.        Tabline  - line showing tab positions
  794.        TOfeof   - *** Top of File *** and *** Bottom of File *** lines
  795.  
  796.      Valid values for 'foreground' and 'background':
  797.        black,blue,green,cyan,red,magenta,yellow,white
  798.  
  799.      Valid values for 'modifier':
  800.        normal,blink,bold,bright,high,reverse,underline
  801.  
  802.      It is an error to attempt to set a colour on a mono display.
  803.  
  804. COMPATIBILITY
  805.      XEDIT: Functionally compatible. See below.
  806.      KEDIT: Functionally compatible. See below.
  807.      Does not implement all modifiers.
  808.  
  809. DEFAULT
  810.      Depends on compatibility mode setting.
  811.  
  812. SEE ALSO
  813.      SET COMPAT
  814.  
  815. STATUS  
  816.      Complete.
  817. **man-end**********************************************************************/
  818. #ifdef PROTO
  819. short Colour(CHARTYPE *params)
  820. #else
  821. short Colour(params)
  822. CHARTYPE *params;
  823. #endif
  824.  
  825. /***********************************************************************/
  826. {
  827. /*-------------------------- external data ----------------------------*/
  828.  extern WINDOW *foot;
  829.  extern WINDOW *error_window;
  830.  extern WINDOW *divider;
  831.  extern bool curses_started;
  832.  extern bool horizontal;
  833.  extern CHARTYPE display_screens;
  834. /*--------------------------- local data ------------------------------*/
  835.  struct areas
  836.  {
  837.   CHARTYPE *area;
  838.   short area_min_len;
  839.   short area_window;
  840.  };
  841.  typedef struct areas AREAS;
  842.  static AREAS valid_areas[ATTR_MAX]=
  843.  {
  844.   {(CHARTYPE *)"filearea",1,WINDOW_MAIN},
  845.   {(CHARTYPE *)"curline",2,WINDOW_MAIN},
  846.   {(CHARTYPE *)"block",1,WINDOW_MAIN},
  847.   {(CHARTYPE *)"cblock",2,WINDOW_MAIN},
  848.   {(CHARTYPE *)"cmdline",1,WINDOW_COMMAND},
  849.   {(CHARTYPE *)"idline",1,WINDOW_IDLINE},
  850.   {(CHARTYPE *)"msgline",1,WINDOW_ERROR},
  851.   {(CHARTYPE *)"arrow",1,WINDOW_ARROW},
  852.   {(CHARTYPE *)"prefix",2,WINDOW_PREFIX},
  853.   {(CHARTYPE *)"pending",1,WINDOW_PREFIX},
  854.   {(CHARTYPE *)"scale",1,WINDOW_MAIN},
  855.   {(CHARTYPE *)"tofeof",2,WINDOW_MAIN},
  856.   {(CHARTYPE *)"ctofeof",2,WINDOW_MAIN},
  857.   {(CHARTYPE *)"tabline",1,WINDOW_MAIN},
  858.   {(CHARTYPE *)"shadow",2,WINDOW_MAIN},
  859.   {(CHARTYPE *)"statarea",2,WINDOW_FOOTING},
  860.   {(CHARTYPE *)"divider",1,WINDOW_DIVIDER},
  861.   {(CHARTYPE *)"reserved",1,WINDOW_RESERVED}
  862.  };
  863. #define COL_PARAMS 2
  864.  CHARTYPE *word[COL_PARAMS+1];
  865.  CHARTYPE parm[COL_PARAMS];
  866.  register short i=0;
  867.  unsigned short num_params=0;
  868.  short area=0;
  869.  COLOUR_ATTR attr;
  870.  CHARTYPE *dummy=NULL;
  871. /*--------------------------- processing ------------------------------*/
  872. #ifdef TRACE
  873.  trace_function("commset1.c:Colour");
  874. #endif
  875.  num_params = param_split(params,word,COL_PARAMS,WORD_DELIMS,TEMP_PARAM);
  876.  if (num_params < 2 )
  877.     {
  878.      display_error(3,(CHARTYPE *)"",FALSE);
  879. #ifdef TRACE
  880.      trace_return();
  881. #endif
  882.      return(RC_INVALID_OPERAND);
  883.     }
  884. /*---------------------------------------------------------------------*/
  885. /* Check that the supplied area matches one of the values in the area  */
  886. /* array and that the length is at least as long as the minimum.       */
  887. /*---------------------------------------------------------------------*/
  888.  parm[0] = FALSE;
  889.  for (i=0;i<ATTR_MAX;i++)
  890.     {
  891.      if (equal(valid_areas[i].area,word[0],valid_areas[i].area_min_len))
  892.        {
  893.         parm[0] = TRUE;
  894.         area = i;
  895.         break;
  896.        }
  897.     }
  898.  if (parm[0] == FALSE)
  899.     {
  900.      display_error(1,(CHARTYPE *)word[0],FALSE);
  901. #ifdef TRACE
  902.      trace_return();
  903. #endif
  904.      return(RC_INVALID_OPERAND);
  905.     }
  906.  memcpy(&attr,CURRENT_FILE->attr+area,sizeof(COLOUR_ATTR));
  907. /*---------------------------------------------------------------------*/
  908. /* Determine colours and modifiers.                                    */
  909. /*---------------------------------------------------------------------*/
  910.  if (parse_colours(word[1],&attr,&dummy,FALSE) != RC_OK)
  911.    {
  912. #ifdef TRACE
  913.     trace_return();
  914. #endif
  915.     return(RC_INVALID_OPERAND);
  916.    }
  917. /*---------------------------------------------------------------------*/
  918. /* Now we have the new colours, save them with the current file...     */
  919. /*---------------------------------------------------------------------*/
  920.  memcpy(CURRENT_FILE->attr+area,&attr,sizeof(COLOUR_ATTR));
  921. /*---------------------------------------------------------------------*/
  922. /* If we haven't started curses (in profile first time) exit now...    */
  923. /*---------------------------------------------------------------------*/
  924.  if (!curses_started)
  925.    {
  926. #ifdef TRACE
  927.     trace_return();
  928. #endif
  929.     return(RC_OK);
  930.    }
  931. /*---------------------------------------------------------------------*/
  932. /* Update the appropriate window with the new colour combination...    */
  933. /*---------------------------------------------------------------------*/
  934.  switch (valid_areas[area].area_window)
  935.    {
  936.     case WINDOW_MAIN:
  937.                         if (area == ATTR_FILEAREA)
  938.                            wattrset(CURRENT_WINDOW_MAIN,set_colour(CURRENT_FILE->attr+area));
  939.                         build_current_screen(); 
  940.                         display_current_screen();
  941.                         break;
  942.     case WINDOW_PREFIX:
  943.                         if (CURRENT_WINDOW_PREFIX != NULL)
  944.                           {
  945.                            wattrset(CURRENT_WINDOW_PREFIX,set_colour(CURRENT_FILE->attr+area));
  946.                            build_current_screen();
  947.                            display_current_screen();
  948.                           }
  949.                         break;
  950.     case WINDOW_COMMAND:
  951.                         if (CURRENT_WINDOW_COMMAND != NULL)
  952.                           {
  953.                            wattrset(CURRENT_WINDOW_COMMAND,set_colour(CURRENT_FILE->attr+area));
  954.                            redraw_window(CURRENT_WINDOW_COMMAND);
  955.                            touchwin(CURRENT_WINDOW_COMMAND);
  956.                            wnoutrefresh(CURRENT_WINDOW_COMMAND);
  957.                           }
  958.                         break;
  959.     case WINDOW_ARROW:
  960.                         if (CURRENT_WINDOW_ARROW != NULL)
  961.                           {
  962.                            wattrset(CURRENT_WINDOW_ARROW,set_colour(CURRENT_FILE->attr+area));
  963.                            redraw_window(CURRENT_WINDOW_ARROW);
  964.                            touchwin(CURRENT_WINDOW_ARROW);
  965.                            wnoutrefresh(CURRENT_WINDOW_ARROW);
  966.                           }
  967.                         break;
  968.     case WINDOW_IDLINE:
  969.                         if (CURRENT_WINDOW_IDLINE != NULL)
  970.                           {
  971.                            wattrset(CURRENT_WINDOW_IDLINE,set_colour(CURRENT_FILE->attr+area));
  972.                            redraw_window(CURRENT_WINDOW_IDLINE);
  973.                            touchwin(CURRENT_WINDOW_IDLINE);
  974.                            wnoutrefresh(CURRENT_WINDOW_IDLINE);
  975.                           }
  976.                         break;
  977.     case WINDOW_FOOTING:
  978.                         if (foot != NULL)
  979.                           {
  980.                            wattrset(foot,set_colour(CURRENT_FILE->attr+area));
  981.                            redraw_window(foot);
  982.                            touchwin(foot);
  983.                            wnoutrefresh(foot);
  984.                           }
  985.                         break;
  986.     case WINDOW_DIVIDER:
  987.                         if (divider != (WINDOW *)NULL)
  988.                           {
  989. #ifdef A_ALTCHARSET
  990.                            wattrset(divider,A_ALTCHARSET|set_colour(CURRENT_FILE->attr+area));
  991. #else
  992.                            wattrset(divider,set_colour(CURRENT_FILE->attr+area));
  993. #endif
  994.                            if (display_screens > 1
  995.                            &&  !horizontal)
  996.                              {
  997.                               redraw_window(divider);
  998.                               touchwin(divider);
  999.                               wnoutrefresh(divider);
  1000.                              }
  1001.                           }
  1002.                         break;
  1003.     default:
  1004.                         break;
  1005.    }
  1006. #ifdef TRACE
  1007.  trace_return();
  1008. #endif
  1009.  return(RC_OK);
  1010. }
  1011. /*man-start*********************************************************************
  1012. COMMAND
  1013.      compat - set compatibility mode
  1014.  
  1015. SYNTAX
  1016.      [SET] COMPat The|Xedit|Kedit
  1017.  
  1018. DESCRIPTION
  1019.      The COMPAT command changes some settings of THE to make it 
  1020.      more compatible with the behaviour of XEDIT and KEDIT.
  1021.  
  1022.      This command is most useful as the first [SET] command in a
  1023.      profile file. It will change the default settings of THE to
  1024.      initially look like the chosen editor. You can then make any
  1025.      additional changes in THE by issuing other [SET] commands.
  1026.  
  1027. COMPATIBILITY
  1028.      XEDIT: N/A
  1029.      KEDIT: N/A
  1030.  
  1031. DEFAULT
  1032.      THE
  1033.  
  1034. STATUS  
  1035.      Complete.
  1036. **man-end**********************************************************************/
  1037. #ifdef PROTO
  1038. short Compat(CHARTYPE *params)
  1039. #else
  1040. short Compat(params)
  1041. CHARTYPE *params;
  1042. #endif
  1043.  
  1044. /***********************************************************************/
  1045. {
  1046. /*-------------------------- external data ----------------------------*/
  1047.  extern WINDOW *foot;
  1048.  extern WINDOW *error_window;
  1049.  extern WINDOW *divider;
  1050.  extern bool curses_started;
  1051.  extern bool horizontal;
  1052.  extern short compatible;
  1053.  extern CHARTYPE display_screens;
  1054.  extern VIEW_DETAILS *vd_first;
  1055. /*--------------------------- local data ------------------------------*/
  1056.  int rc=RC_OK;
  1057.  int prey=0,prex=0;
  1058.  VIEW_DETAILS *viewp=NULL;
  1059. /*--------------------------- processing ------------------------------*/
  1060. #ifdef TRACE
  1061.  trace_function("commset1.c:Compat");
  1062. #endif
  1063. /*---------------------------------------------------------------------*/
  1064. /* Parse the parameter...                                              */
  1065. /*---------------------------------------------------------------------*/
  1066.  if (equal("THE",params,1))
  1067.     compatible = COMPAT_THE;
  1068.  else
  1069.     if (equal("XEDIT",params,1))
  1070.        compatible = COMPAT_XEDIT;
  1071.     else
  1072.        if (equal("KEDIT",params,1))
  1073.           compatible = COMPAT_KEDIT;
  1074.        else
  1075.          {
  1076.           display_error(1,params,FALSE);
  1077. #ifdef TRACE
  1078.           trace_return();
  1079. #endif
  1080.           return(RC_INVALID_OPERAND);
  1081.          }
  1082.  if (curses_started)
  1083.    {
  1084.     if (CURRENT_WINDOW_PREFIX != NULL)
  1085.        getyx(CURRENT_WINDOW_PREFIX,prey,prex);
  1086.    }
  1087.  post_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line);
  1088. /*---------------------------------------------------------------------*/
  1089. /* Reset common settings to defaults for THE...                        */
  1090. /*---------------------------------------------------------------------*/
  1091.  set_global_defaults();
  1092.  viewp = vd_first;
  1093.  while(viewp != NULL)
  1094.    {
  1095.     set_file_defaults(viewp->file_for_view);
  1096.     set_view_defaults(viewp);
  1097.     viewp = viewp->next;
  1098.    }
  1099. /*---------------------------------------------------------------------*/
  1100. /* Set different default for the other compatibility modes...          */
  1101. /*---------------------------------------------------------------------*/
  1102.  switch(compatible)
  1103.    {
  1104.     case COMPAT_THE:
  1105.          rc = set_THE_defaults(prey,prex);
  1106.          break;
  1107.     case COMPAT_XEDIT:
  1108.          rc = set_XEDIT_defaults(prey,prex);
  1109.          break;
  1110.     case COMPAT_KEDIT:
  1111.          rc = set_KEDIT_defaults(prey,prex);
  1112.          break;
  1113.    }
  1114.  if (rc != RC_OK)
  1115.    {
  1116. #ifdef TRACE
  1117.     trace_return();
  1118. #endif
  1119.     return(rc);
  1120.    }
  1121. /*---------------------------------------------------------------------*/
  1122. /* Determine the size of each window in each screen in case any changes*/
  1123. /* in defaults caused some settings to include/exclude some windows... */
  1124. /*---------------------------------------------------------------------*/
  1125.  set_screen_defaults();
  1126. /*---------------------------------------------------------------------*/
  1127. /* For the common windows, set their attributes to match the new values*/
  1128. /*---------------------------------------------------------------------*/
  1129.  if (curses_started
  1130.  &&  foot != NULL)
  1131.    {
  1132.     wattrset(foot,set_colour(CURRENT_FILE->attr+ATTR_STATAREA));
  1133.     clear_footing();
  1134.    }
  1135. /*---------------------------------------------------------------------*/
  1136. /* If more than one screen displayed, redisplay the 'other' screen...  */
  1137. /*---------------------------------------------------------------------*/
  1138.  if (display_screens > 1)
  1139.    {
  1140.     OTHER_SCREEN.screen_view->current_row = calculate_actual_row(OTHER_SCREEN.screen_view->current_base,
  1141.                                                   OTHER_SCREEN.screen_view->current_off,
  1142.                                                   OTHER_SCREEN.rows[WINDOW_MAIN]);
  1143.     pre_process_line(OTHER_SCREEN.screen_view,OTHER_SCREEN.screen_view->focus_line);
  1144.     if (OTHER_SCREEN.screen_view->cmd_line == 'O')
  1145.        OTHER_SCREEN.screen_view->current_window = WINDOW_MAIN;
  1146.     if (curses_started)
  1147.       {
  1148.        if (set_up_windows(current_screen) != RC_OK)
  1149.          {
  1150. #ifdef TRACE
  1151.           trace_return();
  1152. #endif
  1153.           return(rc);
  1154.          }
  1155.        if (!horizontal)
  1156.          {
  1157. #ifdef A_ALTCHARSET
  1158.           wattrset(divider,A_ALTCHARSET|set_colour(OTHER_SCREEN.screen_view->file_for_view->attr+ATTR_DIVIDER));
  1159. #else
  1160.           wattrset(divider,set_colour(OTHER_SCREEN.screen_view->file_for_view->attr+ATTR_DIVIDER));
  1161. #endif
  1162.           redraw_window(divider);
  1163.           wnoutrefresh(divider);
  1164.          }
  1165.       }
  1166.     redraw_screen((current_screen == 0)?1:0);
  1167.     build_other_screen();
  1168.     display_other_screen();
  1169.    }
  1170. /*---------------------------------------------------------------------*/
  1171. /* Redisplay the current screen...                                     */
  1172. /*---------------------------------------------------------------------*/
  1173.  CURRENT_VIEW->current_row = calculate_actual_row(CURRENT_VIEW->current_base,
  1174.                                                   CURRENT_VIEW->current_off,
  1175.                                                   CURRENT_SCREEN.rows[WINDOW_MAIN]);
  1176.  pre_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line);
  1177.  if (CURRENT_VIEW->cmd_line == 'O')
  1178.     CURRENT_VIEW->current_window = WINDOW_MAIN;
  1179.  if (curses_started)
  1180.    {
  1181.     if (set_up_windows(current_screen) != RC_OK)
  1182.       {
  1183. #ifdef TRACE
  1184.        trace_return();
  1185. #endif
  1186.        return(rc);
  1187.       }
  1188.    }
  1189.  redraw_screen(current_screen);
  1190.  build_current_screen(); 
  1191.  display_current_screen();
  1192.  
  1193. #ifdef TRACE
  1194.  trace_return();
  1195. #endif
  1196.  return(rc);
  1197. }
  1198. /*man-start*********************************************************************
  1199. COMMAND
  1200.      curline - set position of current line on screen
  1201.  
  1202. SYNTAX
  1203.      [SET] CURLine M[+n|-n] | [+|-]n
  1204.  
  1205. DESCRIPTION
  1206.      The CURLINE command sets the position of the current line to
  1207.      the physical screen line specified by supplied arguments.
  1208.  
  1209.      The two forms of parameters are:
  1210.      M[+n|-n] - this sets the current line to be relative to the
  1211.                 middle of the screen. A positvie value adds to the
  1212.                 middle line number, a negative subtracts from it.
  1213.                 eg. M+3 on a 24 line screen will be line 15
  1214.                     M-5 on a 24 line screen will be line 7
  1215.  
  1216.      [+|-]n   - this sets the current line to be relative to the
  1217.                 top of the screen (if positive or no sign) or
  1218.                 relative to the bottom of the screen if negative.
  1219.                 eg. +3 or 3 will set current line to line 3
  1220.                     -3 on a 24 line screen will be line 21
  1221.  
  1222.      If the resulting line is outside the bounds of the screen
  1223.      the position of the current line will become the middle line
  1224.      on the screen.
  1225.  
  1226. COMPATIBILITY
  1227.      XEDIT: Compatible.
  1228.      KEDIT: Compatible.
  1229.  
  1230. DEFAULT
  1231.      +6
  1232.  
  1233. STATUS
  1234.      Complete.
  1235. **man-end**********************************************************************/
  1236. #ifdef PROTO
  1237. short Curline(CHARTYPE *params)
  1238. #else
  1239. short Curline(params)
  1240. CHARTYPE *params;
  1241. #endif
  1242. /***********************************************************************/
  1243. {
  1244. /*-------------------------- external data ----------------------------*/
  1245. /*--------------------------- local data ------------------------------*/
  1246. #define CUR_PARAMS  1
  1247.  CHARTYPE *word[CUR_PARAMS+1];
  1248.  short num_params=0;
  1249.  short rc=0;
  1250.  short base=0,off=0;
  1251. /*--------------------------- processing ------------------------------*/
  1252. #ifdef TRACE
  1253.  trace_function("commset1.c:Curline");
  1254. #endif
  1255.  num_params = param_split(params,word,CUR_PARAMS,WORD_DELIMS,TEMP_PARAM);
  1256.  if (num_params < 1)
  1257.    {
  1258.     display_error(3,(CHARTYPE *)"",FALSE);
  1259. #ifdef TRACE
  1260.     trace_return();
  1261. #endif
  1262.     return(RC_INVALID_OPERAND);
  1263.    }
  1264.  if (num_params > 1)
  1265.    {
  1266.     display_error(2,(CHARTYPE *)"",FALSE);
  1267. #ifdef TRACE
  1268.     trace_return();
  1269. #endif
  1270.     return(RC_INVALID_OPERAND);
  1271.    }
  1272. /*---------------------------------------------------------------------*/
  1273. /* Parse the parameter...                                              */
  1274. /*---------------------------------------------------------------------*/
  1275.  rc = execute_set_row_position(params,&base,&off);
  1276.  if (rc != RC_OK)
  1277.    {
  1278. #ifdef TRACE
  1279.     trace_return();
  1280. #endif
  1281.     return(rc);
  1282.    }
  1283.  CURRENT_VIEW->current_base = (CHARTYPE)base;
  1284.  CURRENT_VIEW->current_off = off;
  1285.  post_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line);
  1286.  CURRENT_VIEW->current_row = calculate_actual_row(CURRENT_VIEW->current_base,
  1287.                                                   CURRENT_VIEW->current_off,
  1288.                                                   CURRENT_SCREEN.rows[WINDOW_MAIN]);
  1289.  build_current_screen(); 
  1290.  display_current_screen();
  1291.  
  1292. #ifdef TRACE
  1293.  trace_return();
  1294. #endif
  1295.  return(RC_OK);
  1296. }
  1297. /*man-start*********************************************************************
  1298. COMMAND
  1299.      dirinclude - set the file mask for directory command
  1300.  
  1301. SYNTAX
  1302.      [SET] DIRInclude * 
  1303.      [SET] DIRInclude [Normal] [Readonly] [System] [Hidden] [Directory]
  1304.  
  1305. DESCRIPTION
  1306.      The DIRINCLUDE command sets the file mask for files that will be
  1307.      displayed on subsequent DIRECTORY commands. The operand "*" will
  1308.      set the mask to all files, the other options will set the
  1309.      mask to include those options specified together with "normal"
  1310.      files eg.
  1311.  
  1312.       DIRINCLUDE R S
  1313.  
  1314.      will display readonly and system files together with "normal" files
  1315.      the next time the DIRECTORY command is issued.
  1316.  
  1317.      The effects of DIRINCLUDE are ignored in the Unix version.
  1318.  
  1319. COMPATIBILITY
  1320.      XEDIT: N/A
  1321.      KEDIT: N/A
  1322.  
  1323. DEFAULT
  1324.      *
  1325.  
  1326. SEE ALSO
  1327.      DIRECTORY, LS
  1328.  
  1329. STATUS
  1330.      Complete.
  1331. **man-end**********************************************************************/
  1332. #ifdef PROTO
  1333. short Dirinclude(CHARTYPE *params)
  1334. #else
  1335. short Dirinclude(params)
  1336. CHARTYPE *params;
  1337. #endif
  1338. /***********************************************************************/
  1339. {
  1340. /*--------------------------- local data ------------------------------*/
  1341.  short rc=RC_OK;
  1342. /*--------------------------- processing ------------------------------*/
  1343. #ifdef TRACE
  1344.  trace_function("commset1.c:Dirinclude");
  1345. #endif
  1346.  rc = set_dirtype(params);
  1347. #ifdef TRACE
  1348.  trace_return();
  1349. #endif
  1350.  return(rc);
  1351. }
  1352. /*man-start*********************************************************************
  1353. COMMAND
  1354.      display - specify which level of lines to display
  1355.  
  1356. SYNTAX
  1357.      [SET] DISPlay n [m|*]
  1358.  
  1359. DESCRIPTION
  1360.      The DISPLAY command sets the selection level for lines to be
  1361.      displayed on the screen.
  1362.  
  1363. COMPATIBILITY
  1364.      XEDIT: Compatible.
  1365.      KEDIT: Compatible.
  1366.  
  1367. DEFAULT
  1368.      0 0
  1369.  
  1370. SEE ALSO
  1371.      SET SCOPE, SET SELECT, ALL
  1372.  
  1373. STATUS
  1374.      Complete.
  1375. **man-end**********************************************************************/
  1376. #ifdef PROTO
  1377. short Display(CHARTYPE *params)
  1378. #else
  1379. short Display(params)
  1380. CHARTYPE *params;
  1381. #endif
  1382. /***********************************************************************/
  1383. {
  1384. /*-------------------------- external data ----------------------------*/
  1385. /*--------------------------- local data ------------------------------*/
  1386.  short rc=RC_OK;
  1387. #define DIS_PARAMS  2
  1388.  CHARTYPE *word[DIS_PARAMS+1];
  1389.  unsigned short num_params=0;
  1390.  short col1=0,col2=0;
  1391. /*--------------------------- processing ------------------------------*/
  1392. #ifdef TRACE
  1393.  trace_function("commset1.c:Display");
  1394. #endif
  1395. /*---------------------------------------------------------------------*/
  1396. /* Validate the parameters that have been supplied. One only           */
  1397. /* parameter MUST be supplied. The first parameter MUST be a positive  */
  1398. /* integer. The second can be a positive integer or '*'. If no second  */
  1399. /* parameter is supplied, defaults to p1. The second parameter MUST be */
  1400. /* >= first parameter. '*' is regarded as the biggest number and is    */
  1401. /* literally 255.                                                      */
  1402. /*---------------------------------------------------------------------*/
  1403.  num_params = param_split(params,word,DIS_PARAMS,WORD_DELIMS,TEMP_PARAM);
  1404.  if (num_params < 1)
  1405.    {
  1406.     display_error(3,"",FALSE);
  1407. #ifdef TRACE
  1408.     trace_return();
  1409. #endif
  1410.     return(RC_INVALID_OPERAND);
  1411.    }
  1412.  if (num_params > 2)
  1413.    {
  1414.     display_error(2,"",FALSE);
  1415. #ifdef TRACE
  1416.     trace_return();
  1417. #endif
  1418.     return(RC_INVALID_OPERAND);
  1419.    }
  1420.  if (!valid_positive_integer(word[0]))
  1421.    {
  1422.     display_error(4,word[0],FALSE);
  1423. #ifdef TRACE
  1424.     trace_return();
  1425. #endif
  1426.     return(RC_INVALID_OPERAND);
  1427.    }
  1428.  col1 = atoi(word[0]);
  1429.  if (strcmp(word[1],"*") == 0)
  1430.     col2 = 255;
  1431.  else
  1432.     if (num_params == 1)      /* no second parameter, default to first */
  1433.        col2 = col1;
  1434.     else
  1435.        if (!valid_positive_integer(word[1]))
  1436.          {
  1437.           display_error(4,word[1],FALSE);
  1438. #ifdef TRACE
  1439.           trace_return();
  1440. #endif
  1441.           return(RC_INVALID_OPERAND);
  1442.          }
  1443.        else
  1444.           col2 = atoi(word[1]);
  1445.  
  1446.  if (col2 > 255)
  1447.     col2 = 255;
  1448.  if (col1 > col2)
  1449.    {
  1450.     display_error(6,word[0],FALSE);
  1451. #ifdef TRACE
  1452.     trace_return();
  1453. #endif
  1454.     return(RC_INVALID_OPERAND);
  1455.    }
  1456.  CURRENT_VIEW->display_low = col1;
  1457.  CURRENT_VIEW->display_high = col2;
  1458. /*---------------------------------------------------------------------*/
  1459. /* If we are on the command line and the result of this statement means*/
  1460. /* that the current line is no longer in scope, we need to make the    */
  1461. /* current line and possibly the focus line the next line in scope.    */
  1462. /*---------------------------------------------------------------------*/
  1463.  if (CURRENT_VIEW->current_window == WINDOW_COMMAND)
  1464.    {
  1465.     CURRENT_VIEW->current_line = find_next_in_scope(NULL,get_true_line(),DIRECTION_FORWARD);
  1466.     build_current_screen(); 
  1467.     if (!line_in_view(CURRENT_VIEW->focus_line))
  1468.       {
  1469.        CURRENT_VIEW->focus_line = CURRENT_VIEW->current_line;
  1470.        pre_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line);
  1471.       }
  1472.    }
  1473.  pre_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line);
  1474.  build_current_screen(); 
  1475.  display_current_screen();
  1476.  
  1477. #ifdef TRACE
  1478.  trace_return();
  1479. #endif
  1480.  return(rc);
  1481. }
  1482. /*man-start*********************************************************************
  1483. COMMAND
  1484.      eolout - set end of line terminating character(s)
  1485.  
  1486. SYNTAX
  1487.      [SET] EOLout CRLF|LF
  1488.  
  1489. DESCRIPTION
  1490.      The EOLOUT command allows the user to specify the combination of
  1491.      characters that terminate a line. Lines of text in Unix files are
  1492.      usually terminated with a LF, whereas in DOS they usually end with
  1493.      a CR and LF combination.
  1494.  
  1495. COMPATIBILITY
  1496.      XEDIT: N/A
  1497.      KEDIT: N/A
  1498.  
  1499. DEFAULT
  1500.      LF - Unix, CRLF - DOS/OS2
  1501.  
  1502. STATUS
  1503.      Complete.
  1504. **man-end**********************************************************************/
  1505. #ifdef PROTO
  1506. short Eolout(CHARTYPE *params)
  1507. #else
  1508. short Eolout(params)
  1509. CHARTYPE *params;
  1510. #endif
  1511. /***********************************************************************/
  1512. {
  1513. /*-------------------------- external data ----------------------------*/
  1514.  extern CHARTYPE EOLx;
  1515. /*--------------------------- local data ------------------------------*/
  1516.  CHARTYPE eolchar=0;
  1517. /*--------------------------- processing ------------------------------*/
  1518. #ifdef TRACE
  1519.  trace_function("commset1.c:Eolout");
  1520. #endif
  1521.  if (equal((CHARTYPE *)"lf",params,2))
  1522.     eolchar = EOLOUT_LF;
  1523.  else
  1524.     if (equal((CHARTYPE *)"crlf",params,4))
  1525.        eolchar = EOLOUT_CRLF;
  1526.     else
  1527.       {
  1528.        display_error(1,(CHARTYPE *)params,FALSE);
  1529. #ifdef TRACE
  1530.        trace_return();
  1531. #endif
  1532.        return(RC_INVALID_OPERAND);
  1533.       }
  1534.  EOLx = CURRENT_FILE->eolout = eolchar;
  1535. #ifdef TRACE
  1536.  trace_return();
  1537. #endif
  1538.  return(RC_OK);
  1539. }
  1540. /*man-start*********************************************************************
  1541. COMMAND
  1542.      etmode - indicate if extended display mode is possible
  1543.  
  1544. SYNTAX
  1545.      [SET] ETMODE ON|OFF
  1546.  
  1547. DESCRIPTION
  1548.      The ETMODE command allows the user to specify if extended ASCII
  1549.      codes ( > 127) are to be displayed or should be displayed as
  1550.      the NONDISP character.
  1551.  
  1552. COMPATIBILITY
  1553.      XEDIT: Similar function but deals with Double-Byte characters
  1554.      KEDIT: N/A
  1555.  
  1556. DEFAULT
  1557.      ON - DOS/OS2, OFF - Unix
  1558.  
  1559. SEE ALSO
  1560.      SET NONDISP
  1561.  
  1562. STATUS
  1563.      Complete.
  1564. **man-end**********************************************************************/
  1565. #ifdef PROTO
  1566. short Etmode(CHARTYPE *params)
  1567. #else
  1568. short Etmode(params)
  1569. CHARTYPE *params;
  1570. #endif
  1571. /***********************************************************************/
  1572. {
  1573. /*-------------------------- external data ----------------------------*/
  1574.  extern bool ETMODEx;
  1575. /*--------------------------- local data ------------------------------*/
  1576.  short rc=RC_OK;
  1577. /*--------------------------- processing ------------------------------*/
  1578. #ifdef TRACE
  1579.  trace_function("commset1.c:Etmode");
  1580. #endif
  1581.  rc = execute_set_on_off(params,&ETMODEx);
  1582.  if (rc == RC_OK)
  1583.    {
  1584.     build_current_screen(); 
  1585.     display_current_screen();
  1586.    }
  1587. #ifdef TRACE
  1588.  trace_return();
  1589. #endif
  1590.  return(rc);
  1591. }
  1592. /*man-start*********************************************************************
  1593. COMMAND
  1594.      hex - set how hexidecimal strings are treated in string operands
  1595.  
  1596. SYNTAX
  1597.      [SET] HEX ON|OFF
  1598.  
  1599. DESCRIPTION
  1600.      The HEX set command determines whether hexidecimal strings are
  1601.      treated as such in string operands.
  1602.      With HEX ON, any string operand of the form
  1603.         /x'31 32 33'/ or
  1604.         /d'49 50 51'/
  1605.      will be converted to /123/ before the command is executed.
  1606.      With HEX OFF, no conversion is done.
  1607.  
  1608.      This conversion should work wherever a string operand is used
  1609.      in any command.
  1610.  
  1611. COMPATIBILITY
  1612.      XEDIT: Adds support for decimal representation. See below.
  1613.      KEDIT: Compatible. See below.
  1614.      Spaces must seperate each character representation.
  1615.  
  1616. DEFAULT
  1617.      OFF
  1618.  
  1619. STATUS
  1620.      Complete.
  1621. **man-end**********************************************************************/
  1622. #ifdef PROTO
  1623. short Hex(CHARTYPE *params)
  1624. #else
  1625. short Hex(params)
  1626. CHARTYPE *params;
  1627. #endif
  1628. /***********************************************************************/
  1629. {
  1630. /*-------------------------- external data ----------------------------*/
  1631. /*--------------------------- local data ------------------------------*/
  1632.  short rc=RC_OK;
  1633. /*--------------------------- processing ------------------------------*/
  1634. #ifdef TRACE
  1635.  trace_function("commset1.c:Hex");
  1636. #endif
  1637.  rc = execute_set_on_off(params,&CURRENT_VIEW->hex);
  1638. #ifdef TRACE
  1639.  trace_return();
  1640. #endif
  1641.  return(rc);
  1642. }
  1643. /*man-start*********************************************************************
  1644. COMMAND
  1645.      hexdisplay - turn on or off display of character under cursor
  1646.  
  1647. SYNTAX
  1648.      [SET] HEXDISPlay ON|OFF
  1649.  
  1650. DESCRIPTION
  1651.      The HEXDISPLAY command turns on or off the display of the character under
  1652.      the cursor on the status line.
  1653.  
  1654. COMPATIBILITY
  1655.      XEDIT: N/A
  1656.      KEDIT: Compatible.
  1657.  
  1658. DEFAULT
  1659.      ON
  1660.  
  1661. STATUS
  1662.      Complete
  1663. **man-end**********************************************************************/
  1664. #ifdef PROTO
  1665. short Hexdisplay(CHARTYPE *params)
  1666. #else
  1667. short Hexdisplay(params)
  1668. CHARTYPE *params;
  1669. #endif
  1670. /***********************************************************************/
  1671. {
  1672. /*-------------------------- external data ----------------------------*/
  1673.  extern bool HEXDISPLAYx;
  1674.  extern bool curses_started;
  1675. /*--------------------------- local data ------------------------------*/
  1676.  short rc=RC_OK;
  1677. /*--------------------------- processing ------------------------------*/
  1678. #ifdef TRACE
  1679.  trace_function("commset1.c:Hexdisplay");
  1680. #endif
  1681.  rc = execute_set_on_off(params,&HEXDISPLAYx);
  1682.  if (rc == RC_OK
  1683.  &&  curses_started)
  1684.     clear_footing();
  1685. #ifdef TRACE
  1686.  trace_return();
  1687. #endif
  1688.  return(rc);
  1689. }
  1690. /*man-start*********************************************************************
  1691. COMMAND
  1692.      hexshow - turn on or off hex display of current line
  1693.  
  1694. SYNTAX
  1695.      [SET] HEXShow ON|OFF [M[+n|-n]|[+|-]n]
  1696.  
  1697. DESCRIPTION
  1698.      The HEXShow command indicates if and where a hexidecimal
  1699.      representation of the current line will be displayed.
  1700.  
  1701.      The two forms of the position parameters are:
  1702.      M[+n|-n] - this sets the hexshow line to be relative to the
  1703.                 middle of the screen. A positive value adds to the
  1704.                 middle line number, a negative subtracts from it.
  1705.                 eg. M+3 on a 24 line screen will be line 15
  1706.                     M-5 on a 24 line screen will be line 7
  1707.  
  1708.      [+|-]n   - this sets the hexshow line to be relative to the
  1709.                 top of the screen (if positive or no sign) or
  1710.                 relative to the bottom of the screen if negative.
  1711.                 eg. +3 or 3 will set scale line to line 3
  1712.                     -3 on a 24 line screen will be line 21
  1713.  
  1714.      If the resulting line is outside the bounds of the screen
  1715.      the position of the hexshow line will become the middle line
  1716.      on the screen.
  1717.  
  1718.      The position argument specifies the position of the first line
  1719.      of the hexidecimal display.
  1720.  
  1721. COMPATIBILITY
  1722.      XEDIT: N/A
  1723.      KEDIT: N/A
  1724.  
  1725. DEFAULT
  1726.      OFF 7
  1727.  
  1728. STATUS
  1729.      Complete
  1730. **man-end**********************************************************************/
  1731. #ifdef PROTO
  1732. short Hexshow(CHARTYPE *params)
  1733. #else
  1734. short Hexshow(params)
  1735. CHARTYPE *params;
  1736. #endif
  1737. /***********************************************************************/
  1738. {
  1739. /*-------------------------- external data ----------------------------*/
  1740. /*--------------------------- local data ------------------------------*/
  1741. #define HEXS_PARAMS  2
  1742.  CHARTYPE *word[HEXS_PARAMS+1];
  1743.  short num_params=0;
  1744.  short rc=RC_OK;
  1745.  short base=(short)CURRENT_VIEW->hexshow_base;
  1746.  short off=CURRENT_VIEW->hexshow_off;
  1747.  bool hexshowsts=FALSE;
  1748. /*--------------------------- processing ------------------------------*/
  1749. #ifdef TRACE
  1750.  trace_function("commset1.c:Hexshow");
  1751. #endif
  1752.  num_params = param_split(params,word,HEXS_PARAMS,WORD_DELIMS,TEMP_PARAM);
  1753.  if (num_params < 1)
  1754.    {
  1755.     display_error(3,(CHARTYPE *)"",FALSE);
  1756. #ifdef TRACE
  1757.     trace_return();
  1758. #endif
  1759.     return(RC_INVALID_OPERAND);
  1760.    }
  1761. /*---------------------------------------------------------------------*/
  1762. /* Parse the status parameter...                                       */
  1763. /*---------------------------------------------------------------------*/
  1764.  rc = execute_set_on_off(word[0],&hexshowsts);
  1765.  if (rc != RC_OK)
  1766.    {
  1767. #ifdef TRACE
  1768.     trace_return();
  1769. #endif
  1770.     return(rc);
  1771.    }
  1772. /*---------------------------------------------------------------------*/
  1773. /* Parse the position parameter...                                     */
  1774. /*---------------------------------------------------------------------*/
  1775.  if (num_params > 1)
  1776.    {
  1777.     rc = execute_set_row_position(word[1],&base,&off);
  1778.     if (rc != RC_OK)
  1779.       {
  1780. #ifdef TRACE
  1781.        trace_return();
  1782. #endif
  1783.        return(rc);
  1784.       }
  1785.    }
  1786.  CURRENT_VIEW->hexshow_base = (CHARTYPE)base;
  1787.  CURRENT_VIEW->hexshow_off = off;
  1788.  CURRENT_VIEW->hexshow_on = hexshowsts;
  1789.  post_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line);
  1790.  build_current_screen(); 
  1791.  display_current_screen();
  1792. #ifdef TRACE
  1793.  trace_return();
  1794. #endif
  1795.  return(rc);
  1796. }
  1797. /*man-start*********************************************************************
  1798. COMMAND
  1799.      idline - specify if IDLINE is displayed
  1800.  
  1801. SYNTAX
  1802.      [SET] IDline ON|OFF
  1803.  
  1804. DESCRIPTION
  1805.      The IDLINE set command determines if the IDLINE for a file is
  1806.      displayed or not.
  1807.  
  1808. COMPATIBILITY
  1809.      XEDIT: N/A
  1810.      KEDIT: Compatible.
  1811.  
  1812. DEFAULT
  1813.      ON
  1814.  
  1815. STATUS
  1816.      Complete
  1817. **man-end**********************************************************************/
  1818. #ifdef PROTO
  1819. short Idline(CHARTYPE *params)
  1820. #else
  1821. short Idline(params)
  1822. CHARTYPE *params;
  1823. #endif
  1824. /***********************************************************************/
  1825. {
  1826. /*-------------------------- external data ----------------------------*/
  1827.  extern bool curses_started;
  1828. /*--------------------------- local data ------------------------------*/
  1829.  short rc=RC_OK;
  1830.  bool save_id_line=FALSE;
  1831. /*--------------------------- processing ------------------------------*/
  1832. #ifdef TRACE
  1833.  trace_function("commset2.c:Idline");
  1834. #endif
  1835.  save_id_line = CURRENT_VIEW->id_line;
  1836.  rc = execute_set_on_off(params,&CURRENT_VIEW->id_line);
  1837.  if (rc != RC_OK)
  1838.    {
  1839. #ifdef TRACE
  1840.     trace_return();
  1841. #endif
  1842.     return(rc);
  1843.    }
  1844. /*---------------------------------------------------------------------*/
  1845. /* If the new value of id_line is the same as before, exit now.        */
  1846. /*---------------------------------------------------------------------*/
  1847.  if (save_id_line == CURRENT_VIEW->id_line)
  1848.    {
  1849. #ifdef TRACE
  1850.     trace_return();
  1851. #endif
  1852.     return(rc);
  1853.    }
  1854. /*---------------------------------------------------------------------*/
  1855. /* Redefine the screen sizes...                                        */
  1856. /*---------------------------------------------------------------------*/
  1857.  set_screen_defaults();
  1858. /*---------------------------------------------------------------------*/
  1859. /* Recreate windows for the current screen...                          */
  1860. /*---------------------------------------------------------------------*/
  1861.  if (curses_started)
  1862.    {
  1863.     if (set_up_windows(current_screen) != RC_OK)
  1864.       {
  1865. #ifdef TRACE
  1866.        trace_return();
  1867. #endif
  1868.        return(rc);
  1869.       }
  1870.    }
  1871.  build_current_screen();
  1872.  display_current_screen();
  1873. #ifdef TRACE
  1874.  trace_return();
  1875. #endif
  1876.  return(rc);
  1877. }
  1878. /*man-start*********************************************************************
  1879. COMMAND
  1880.      impcmscp - set implied operating system command processing
  1881.  
  1882. SYNTAX
  1883.      [SET] IMPcmscp ON|OFF
  1884.  
  1885. DESCRIPTION
  1886.      The IMPCMSCP command is used to toggle implied operating system
  1887.      command processing from the command line. By turning this feature 
  1888.      on you can then issue an operating system command without the need 
  1889.      to prefix the operating system command with the OS command.
  1890.  
  1891. COMPATIBILITY
  1892.      XEDIT: Compatible.
  1893.      KEDIT: N/A
  1894.  
  1895. DEFAULT
  1896.      ON
  1897.  
  1898. SEE ALSO
  1899.      SET IMPOS
  1900.  
  1901. STATUS
  1902.      Complete.
  1903. **man-end**********************************************************************/
  1904.  
  1905. /*man-start*********************************************************************
  1906. COMMAND
  1907.      impmacro - set implied macro command processing
  1908.  
  1909. SYNTAX
  1910.      [SET] IMPMACro ON|OFF
  1911.  
  1912. DESCRIPTION
  1913.      The IMPMACRO command is used to toggle implied macro processing
  1914.      from the command line. By turning this feature on you can then
  1915.      issue a macro command without the need to prefix the macro name
  1916.      with the MACRO command.
  1917.  
  1918. COMPATIBILITY
  1919.      XEDIT: N/A
  1920.      KEDIT: Compatible.
  1921.  
  1922. DEFAULT
  1923.      ON
  1924.  
  1925. SEE ALSO
  1926.      MACRO, SET MACROPATH
  1927.  
  1928. STATUS
  1929.      Complete.
  1930. **man-end**********************************************************************/
  1931. #ifdef PROTO
  1932. short Impmacro(CHARTYPE *params)
  1933. #else
  1934. short Impmacro(params)
  1935. CHARTYPE *params;
  1936. #endif
  1937. /***********************************************************************/
  1938. {
  1939. /*-------------------------- external data ----------------------------*/
  1940. /*--------------------------- local data ------------------------------*/
  1941.  short rc=RC_OK;
  1942. /*--------------------------- processing ------------------------------*/
  1943. #ifdef TRACE
  1944.  trace_function("commset1.c:Impmacro");
  1945. #endif
  1946.  rc = execute_set_on_off(params,&CURRENT_VIEW->imp_macro);
  1947. #ifdef TRACE
  1948.  trace_return();
  1949. #endif
  1950.  return(rc);
  1951. }
  1952. /*man-start*********************************************************************
  1953. COMMAND
  1954.      impos - set implied operating system command processing
  1955.  
  1956. SYNTAX
  1957.      [SET] IMPOS ON|OFF
  1958.  
  1959. DESCRIPTION
  1960.      The IMPOS command is used to toggle implied operating system
  1961.      command processing from the command line. By turning this feature 
  1962.      on you can then issue an operating system command without the need 
  1963.      to prefix the operating system command with the OS command.
  1964.  
  1965. COMPATIBILITY
  1966.      XEDIT: Compatible.
  1967.      KEDIT: N/A
  1968.  
  1969. DEFAULT
  1970.      ON
  1971.  
  1972. SEE ALSO
  1973.      SET IMPCMSCP
  1974.  
  1975. STATUS
  1976.      Complete.
  1977. **man-end**********************************************************************/
  1978. #ifdef PROTO
  1979. short Impos(CHARTYPE *params)
  1980. #else
  1981. short Impos(params)
  1982. CHARTYPE *params;
  1983. #endif
  1984. /***********************************************************************/
  1985. {
  1986. /*-------------------------- external data ----------------------------*/
  1987. /*--------------------------- local data ------------------------------*/
  1988.  short rc=RC_OK;
  1989. /*--------------------------- processing ------------------------------*/
  1990. #ifdef TRACE
  1991.  trace_function("commset1.c:Impos");
  1992. #endif
  1993.  rc = execute_set_on_off(params,&CURRENT_VIEW->imp_os);
  1994. #ifdef TRACE
  1995.  trace_return();
  1996. #endif
  1997.  return(rc);
  1998. }
  1999. /*man-start*********************************************************************
  2000. COMMAND
  2001.      insertmode - put editor into or out of insert mode
  2002.  
  2003. SYNTAX
  2004.      [SET] INSERTMode ON|OFF|TOGGLE
  2005.  
  2006. DESCRIPTION
  2007.      The INSERTMODE command toggles the insert mode within THE.
  2008.  
  2009. COMPATIBILITY
  2010.      XEDIT: N/A
  2011.      KEDIT: Compatible.
  2012.  
  2013. DEFAULT
  2014.      OFF
  2015.  
  2016. STATUS
  2017.      Complete.
  2018. **man-end**********************************************************************/
  2019. #ifdef PROTO
  2020. short Insertmode(CHARTYPE *params)
  2021. #else
  2022. short Insertmode(params)
  2023. CHARTYPE *params;
  2024. #endif
  2025. /***********************************************************************/
  2026. {
  2027. /*-------------------------- external data ----------------------------*/
  2028.  extern bool INSERTMODEx;
  2029.  extern bool in_profile;
  2030. /*--------------------------- local data ------------------------------*/
  2031. /*--------------------------- processing ------------------------------*/
  2032. #ifdef TRACE
  2033.  trace_function("commset1.c:Insertmode");
  2034. #endif
  2035.  if (equal((CHARTYPE *)"off",params,3))
  2036.     INSERTMODEx = FALSE;
  2037.  else
  2038.     if (equal((CHARTYPE *)"on",params,2))
  2039.        INSERTMODEx = TRUE;
  2040.     else
  2041.        if (equal((CHARTYPE *)"toggle",params,6))
  2042.           INSERTMODEx = (INSERTMODEx) ? FALSE : TRUE;
  2043.        else
  2044.          {
  2045.           display_error(1,(CHARTYPE *)params,FALSE);
  2046. #ifdef TRACE
  2047.           trace_return();
  2048. #endif
  2049.           return(RC_INVALID_OPERAND);
  2050.          }
  2051.  if (!in_profile)
  2052.     draw_cursor(TRUE);
  2053. #ifdef TRACE
  2054.  trace_return();
  2055. #endif
  2056.  return(RC_OK);
  2057. }
  2058. /*man-start*********************************************************************
  2059. COMMAND
  2060.      linend - allow/disallow multiple commands on command line
  2061.  
  2062. SYNTAX
  2063.      [SET] LINENd ON|OFF [char]
  2064.  
  2065. DESCRIPTION
  2066.      The LINEND command allows or disallows the execution of multiple
  2067.      commands on the command line. When setting LINEND ON, a character
  2068.      is specified as the LINEND character which delimits each command.
  2069.  
  2070. COMPATIBILITY
  2071.      XEDIT: Compatible.
  2072.      KEDIT: Compatible.
  2073.  
  2074. DEFAULT
  2075.      OFF #
  2076.  
  2077. STATUS
  2078.      Complete.
  2079. **man-end**********************************************************************/
  2080. #ifdef PROTO
  2081. short Linend(CHARTYPE *params)
  2082. #else
  2083. short Linend(params)
  2084. CHARTYPE *params;
  2085. #endif
  2086. /***********************************************************************/
  2087. {
  2088. /*-------------------------- external data ----------------------------*/
  2089. /*--------------------------- local data ------------------------------*/
  2090. #define LE_PARAMS  2
  2091.  CHARTYPE *word[LE_PARAMS+1];
  2092.  unsigned short num_params=0;
  2093.  bool le_status=CURRENT_VIEW->linend_status;
  2094.  CHARTYPE le_value=CURRENT_VIEW->linend_value;
  2095.  short rc=RC_OK;
  2096. /*--------------------------- processing ------------------------------*/
  2097. #ifdef TRACE
  2098.  trace_function("commset1.c:Linend");
  2099. #endif
  2100.  num_params = param_split(params,word,LE_PARAMS,WORD_DELIMS,TEMP_PARAM);
  2101.  switch(num_params)
  2102.    {
  2103.     case 1:
  2104.     case 2:
  2105.            if (equal((CHARTYPE *)"off",word[0],3))
  2106.               le_status = FALSE;
  2107.            else
  2108.               if (equal((CHARTYPE *)"on",word[0],2))
  2109.                  le_status = TRUE;
  2110.               else
  2111.                 {
  2112.                  display_error(1,word[0],FALSE);
  2113.                  rc = RC_INVALID_OPERAND;
  2114.                  break;
  2115.                 }
  2116.            if (num_params == 1)
  2117.               break;
  2118.            if (strlen(word[1]) > 1)
  2119.              {
  2120.               display_error(1,word[1],FALSE);
  2121.               break;
  2122.              }
  2123.            le_value = word[1][0];
  2124.            break;
  2125.     case 0:
  2126.            display_error(3,"",FALSE);
  2127.            rc = RC_INVALID_OPERAND;
  2128.            break;
  2129.     default:
  2130.            display_error(2,"",FALSE);
  2131.            rc = RC_INVALID_OPERAND;
  2132.            break;
  2133.    }
  2134.  if (rc == RC_OK)
  2135.    {
  2136.     CURRENT_VIEW->linend_status = le_status;
  2137.     CURRENT_VIEW->linend_value = le_value;
  2138.    }
  2139. #ifdef TRACE
  2140.  trace_return();
  2141. #endif
  2142.  return(rc);
  2143. }
  2144. /*man-start*********************************************************************
  2145. COMMAND
  2146.      macroext - set default macro extension value
  2147.  
  2148. SYNTAX
  2149.      [SET] MACROExt [ext]
  2150.  
  2151. DESCRIPTION
  2152.      The MACROEXT command sets the value of the file extension to be
  2153.      used for macro files. When a macro file name is specified on the
  2154.      command line, a fullstop '.' then this value will be appended.
  2155.      If no value is specified for ext, then THE assumes that the
  2156.      supplied macro file name is the fully specified name for a macro.
  2157.  
  2158.      The length of ext must be 10 characters or less.
  2159.  
  2160.      The macro extension is only appended to a file if that file does
  2161.      not include any path specifiers.
  2162.  
  2163. COMPATIBILITY
  2164.      XEDIT: N/A
  2165.      KEDIT: N/A
  2166.  
  2167. DEFAULT
  2168.      the
  2169.  
  2170. STATUS
  2171.      Complete.
  2172. **man-end**********************************************************************/
  2173. #ifdef PROTO
  2174. short Macroext(CHARTYPE *params)
  2175. #else
  2176. short Macroext(params)
  2177. CHARTYPE *params;
  2178. #endif
  2179. /***********************************************************************/
  2180. {
  2181. /*-------------------------- external data ----------------------------*/
  2182.  extern CHARTYPE macro_suffix[12];
  2183. /*--------------------------- local data ------------------------------*/
  2184. /*--------------------------- processing ------------------------------*/
  2185. #ifdef TRACE
  2186.  trace_function("commset1.c:Macroext");
  2187. #endif
  2188. /*---------------------------------------------------------------------*/
  2189. /* If no value is specified for ext, set the value of macro_suffix to  */
  2190. /* "", otherwise set it to the supplied value, prefixed with '.'       */
  2191. /*---------------------------------------------------------------------*/
  2192.  if (strlen(params) == 0)
  2193.     strcpy(macro_suffix,"");
  2194.  else
  2195.    {
  2196.     if (strlen(params) > 10)
  2197.       {
  2198.        display_error(7,(CHARTYPE *)params,FALSE);
  2199. #ifdef TRACE
  2200.        trace_return();
  2201. #endif
  2202.        return(RC_INVALID_OPERAND);
  2203.       }
  2204.     strcpy(macro_suffix,".");
  2205.     strcat(macro_suffix,params);
  2206.    }
  2207. #ifdef TRACE
  2208.  trace_return();
  2209. #endif
  2210.  return(RC_OK);
  2211. }
  2212. /*man-start*********************************************************************
  2213. COMMAND
  2214.      macropath - set default path for macro commands
  2215.  
  2216. SYNTAX
  2217.      [SET] MACROPath path[s]
  2218.  
  2219. DESCRIPTION
  2220.      The MACROPATH command sets up the search path from which macro
  2221.      command files are executed. Each directory is seperated by a
  2222.      colon (Unix) or semi-colon (DOS & OS/2).
  2223.      No check is done at this stage to validate the supplied path.
  2224.  
  2225. COMPATIBILITY
  2226.      XEDIT: N/A
  2227.      KEDIT: Incompatible.
  2228.  
  2229. DEFAULT
  2230.      Path specified by env variable THE_MACRO_PATH
  2231.  
  2232. SEE ALSO
  2233.      MACRO, SET IMPMACRO
  2234.  
  2235. STATUS
  2236.      Complete.
  2237. **man-end**********************************************************************/
  2238. #ifdef PROTO
  2239. short Macropath(CHARTYPE *params)
  2240. #else
  2241. short Macropath(params)
  2242. CHARTYPE *params;
  2243. #endif
  2244. /***********************************************************************/
  2245. {
  2246. /*-------------------------- external data ----------------------------*/
  2247.  extern CHARTYPE the_macro_path[MAX_FILE_NAME+1];
  2248. /*--------------------------- local data ------------------------------*/
  2249. /*--------------------------- processing ------------------------------*/
  2250. #ifdef TRACE
  2251.  trace_function("commset1.c:Macropath");
  2252. #endif
  2253. /*---------------------------------------------------------------------*/
  2254. /* No checking is done on macro path supplied other than it contains a */
  2255. /* value. Path delimiters are translated if necessary.                 */
  2256. /*---------------------------------------------------------------------*/
  2257.  if (strlen(params) == 0)
  2258.    {
  2259.     display_error(3,(CHARTYPE *)"",FALSE);
  2260. #ifdef TRACE
  2261.     trace_return();
  2262. #endif
  2263.     return(RC_INVALID_OPERAND);
  2264.    }
  2265.  strcpy(the_macro_path,params);
  2266.  (void *)strtrans(the_macro_path,OSLASH,ISLASH);
  2267. #ifdef TRACE
  2268.  trace_return();
  2269. #endif
  2270.  return(RC_OK);
  2271. }
  2272. /*man-start*********************************************************************
  2273. COMMAND
  2274.      margins - set left and right margins for wordwrap
  2275.  
  2276. SYNTAX
  2277.      [SET] MARgins left right [[+|-]indent]
  2278.  
  2279. DESCRIPTION
  2280.      The MARGINS command sets the left and right margins and the
  2281.      number of columns to indent a paragraph.
  2282.      These values are used with the WORDWRAP option.
  2283.  
  2284. COMPATIBILITY
  2285.      XEDIT: N/A
  2286.      KEDIT: Compatible.
  2287.  
  2288. DEFAULT
  2289.      1 72 +0
  2290.  
  2291. SEE ALSO
  2292.      SET WORDWRAP
  2293.  
  2294. STATUS
  2295.      Complete.
  2296. **man-end**********************************************************************/
  2297. #ifdef PROTO
  2298. short Margins(CHARTYPE *params)
  2299. #else
  2300. short Margins(params)
  2301. CHARTYPE *params;
  2302. #endif
  2303. /***********************************************************************/
  2304. {
  2305. /*-------------------------- external data ----------------------------*/
  2306.  extern CHARTYPE *temp_cmd;
  2307. /*--------------------------- local data ------------------------------*/
  2308. #define MAR_PARAMS  3
  2309.  CHARTYPE *word[MAR_PARAMS+1];
  2310.  short num_params=0;
  2311.  short left=0,right=0,indent=0;
  2312.  bool offset=FALSE,consistancy_error=FALSE;
  2313. /*--------------------------- processing ------------------------------*/
  2314. #ifdef TRACE
  2315.  trace_function("commset1.c:Margins");
  2316. #endif
  2317. /*---------------------------------------------------------------------*/
  2318. /* Two parameters are mandatory, the third is optional.                */
  2319. /*---------------------------------------------------------------------*/
  2320.  num_params = param_split(params,word,MAR_PARAMS,WORD_DELIMS,TEMP_PARAM);
  2321.  if (num_params < 2)
  2322.    {
  2323.     display_error(3,(CHARTYPE *)"",FALSE);
  2324. #ifdef TRACE
  2325.     trace_return();
  2326. #endif
  2327.     return(RC_INVALID_OPERAND);
  2328.    }
  2329.  if (num_params > 3)
  2330.    {
  2331.     display_error(2,(CHARTYPE *)"",FALSE);
  2332. #ifdef TRACE
  2333.     trace_return();
  2334. #endif
  2335.     return(RC_INVALID_OPERAND);
  2336.    }
  2337. /*---------------------------------------------------------------------*/
  2338. /* Parse the parameters...                                             */
  2339. /*---------------------------------------------------------------------*/
  2340.  left = atoi(word[0]);
  2341.  if (left < 1)
  2342.    {
  2343.     display_error(5,word[0],FALSE);
  2344. #ifdef TRACE
  2345.     trace_return();
  2346. #endif
  2347.     return(RC_INVALID_OPERAND);
  2348.    }
  2349. /*---------------------------------------------------------------------*/
  2350. /* Right margin value can be *, set to maximum line length.            */
  2351. /*---------------------------------------------------------------------*/
  2352.  if (*(word[1]+1) == '*')
  2353.    {
  2354.     right = max_line_length;
  2355.    }
  2356.  else
  2357.    {
  2358.     right = atoi(word[1]);
  2359.     if (right < 1)
  2360.       {
  2361.        display_error(5,word[1],FALSE);
  2362. #ifdef TRACE
  2363.        trace_return();
  2364. #endif
  2365.        return(RC_INVALID_OPERAND);
  2366.       }
  2367.    }
  2368. /*---------------------------------------------------------------------*/
  2369. /* Left margin must be less than right margin.                         */
  2370. /*---------------------------------------------------------------------*/
  2371.  if (right < left)
  2372.    {
  2373.     display_error(5,word[1],FALSE);
  2374. #ifdef TRACE
  2375.     trace_return();
  2376. #endif
  2377.     return(RC_INVALID_OPERAND);
  2378.    }
  2379. /*---------------------------------------------------------------------*/
  2380. /* Obtain current values for indent, in case they aren't changed by    */
  2381. /* the current command. (ie. no third parameter)                       */
  2382. /*---------------------------------------------------------------------*/
  2383.  indent = CURRENT_VIEW->margin_indent;
  2384.  offset = CURRENT_VIEW->margin_indent_offset;
  2385. /*---------------------------------------------------------------------*/
  2386. /* Determine the type of offset for the indent value. If a sign is     */
  2387. /* specified, then the number supplied is relative to the left margin  */
  2388. /* otherwise it is an absolute column value.                           */
  2389. /*---------------------------------------------------------------------*/
  2390.  if (num_params == 3)
  2391.    {
  2392.     if (*(word[2]) == '-'
  2393.     ||  *(word[2]) == '+')
  2394.       {
  2395.        offset = TRUE;
  2396.        if ((indent = atoi(word[2])) == 0)
  2397.          {
  2398.           if (strcmp(word[2],"+0") != 0)
  2399.             {
  2400.              display_error(1,word[2],FALSE);
  2401. #ifdef TRACE
  2402.              trace_return();
  2403. #endif
  2404.              return(RC_INVALID_OPERAND);
  2405.             }
  2406.          }
  2407.       }
  2408.     else
  2409.       {
  2410.        offset = FALSE;
  2411. /*---------------------------------------------------------------------*/
  2412. /* Absolute indent cannot be negative.                                 */
  2413. /*---------------------------------------------------------------------*/
  2414.        if ((indent = atoi(word[2])) < 0)
  2415.          {
  2416.           display_error(1,word[2],FALSE);
  2417. #ifdef TRACE
  2418.           trace_return();
  2419. #endif
  2420.           return(RC_INVALID_OPERAND);
  2421.          }
  2422.       }
  2423.    }
  2424. /*---------------------------------------------------------------------*/
  2425. /* Once all values are determined, validate the relationship between   */
  2426. /* the margins and the indent values.                                  */
  2427. /* Rules:                                                              */
  2428. /*       o If indent is a negative offset, the resultant column value  */
  2429. /*         cannot be negative.                                         */
  2430. /*       o If indent is a positive offset, the resultant column value  */
  2431. /*         cannot be > max_line_length or right margin                 */
  2432. /*       o If indent is an absolute value, it cannot be > right margin */
  2433. /*---------------------------------------------------------------------*/
  2434.  consistancy_error = FALSE;
  2435.  if (offset
  2436.  && indent < 0
  2437.  && indent + left < 0)
  2438.     consistancy_error = TRUE;
  2439.  if (offset
  2440.  && indent > 0
  2441.  && indent + left > right)
  2442.     consistancy_error = TRUE;
  2443.  if (offset
  2444.  && indent > 0
  2445.  && indent + left > max_line_length)
  2446.     consistancy_error = TRUE;
  2447.  if (!offset
  2448.  && indent > right)
  2449.     consistancy_error = TRUE;
  2450.  if (consistancy_error)
  2451.    {
  2452.     if (offset)
  2453.        sprintf(temp_cmd,"%d %d %+d",left,right,indent);
  2454.     else
  2455.        sprintf(temp_cmd,"%d %d %d",left,right,indent);
  2456.     display_error(12,temp_cmd,FALSE);
  2457. #ifdef TRACE
  2458.     trace_return();
  2459. #endif
  2460.     return(RC_INVALID_OPERAND);
  2461.    }
  2462. /*---------------------------------------------------------------------*/
  2463. /* All OK, so save the values...                                       */
  2464. /*---------------------------------------------------------------------*/
  2465.  CURRENT_VIEW->margin_left = left;
  2466.  CURRENT_VIEW->margin_right = right;
  2467.  CURRENT_VIEW->margin_indent = indent;
  2468.  CURRENT_VIEW->margin_indent_offset = offset;
  2469. /*---------------------------------------------------------------------*/
  2470. /* If the SCALE line is currently displayed, display the page so that  */
  2471. /* any changes are reflected in the SCALE line.                        */
  2472. /*---------------------------------------------------------------------*/
  2473.  if (CURRENT_VIEW->scale_on)
  2474.    {
  2475.     build_current_screen(); 
  2476.     display_current_screen();
  2477.    }
  2478. #ifdef TRACE
  2479.  trace_return();
  2480. #endif
  2481.  return(RC_OK);
  2482. }
  2483. /*man-start*********************************************************************
  2484. COMMAND
  2485.      msgline - set position and size of message line
  2486.  
  2487. SYNTAX
  2488.      [SET] MSGLine ON [M[+n|-n]|[+|-]n] [lines]
  2489.  
  2490. DESCRIPTION
  2491.      The MSGLINE set command specifies the position of the message line
  2492.      and the size of the message line window.
  2493.  
  2494.      The two forms of the position parameters are:
  2495.      M[+n|-n] - this sets the first line to be relative to the
  2496.                 middle of the screen. A positive value adds to the
  2497.                 middle line number, a negative subtracts from it.
  2498.                 eg. M+3 on a 24 line screen will be line 15
  2499.                     M-5 on a 24 line screen will be line 7
  2500.  
  2501.      [+|-]n   - this sets the first line to be relative to the
  2502.                 top of the screen (if positive or no sign) or
  2503.                 relative to the bottom of the screen if negative.
  2504.                 eg. +3 or 3 will set tab line to line 3
  2505.                     -3 on a 24 line screen will be line 21
  2506.  
  2507.      If the resulting line is outside the bounds of the screen
  2508.      the position of the message line will become the middle line
  2509.      on the screen.
  2510.  
  2511. COMPATIBILITY
  2512.      XEDIT: Compatible.
  2513.             Does not support OVERLAY option.
  2514.      KEDIT: Compatible
  2515.             Does not support OVERLAY option.
  2516.  
  2517. DEFAULT
  2518.      ON 2 1
  2519.  
  2520. STATUS
  2521.      Complete
  2522. **man-end**********************************************************************/
  2523. #ifdef PROTO
  2524. short Msgline(CHARTYPE *params)
  2525. #else
  2526. short Msgline(params)
  2527. CHARTYPE *params;
  2528. #endif
  2529. /***********************************************************************/
  2530. {
  2531. #define MSG_PARAMS  3
  2532.  CHARTYPE *word[MSG_PARAMS+1];
  2533.  short num_params=0;
  2534.  short rc=RC_OK;
  2535.  short base=(short)CURRENT_VIEW->msgline_base;
  2536.  short off=CURRENT_VIEW->msgline_off;
  2537.  bool msgsts=FALSE;
  2538.  ROWTYPE num_lines=CURRENT_VIEW->msgline_rows;
  2539. /*--------------------------- processing ------------------------------*/
  2540. #ifdef TRACE
  2541.  trace_function("commset1.c:Msgline");
  2542. #endif
  2543.  num_params = param_split(params,word,MSG_PARAMS,WORD_DELIMS,TEMP_PARAM);
  2544.  if (num_params < 2)
  2545.    {
  2546.     display_error(3,(CHARTYPE *)"",FALSE);
  2547. #ifdef TRACE
  2548.     trace_return();
  2549. #endif
  2550.     return(RC_INVALID_OPERAND);
  2551.    }
  2552. /*---------------------------------------------------------------------*/
  2553. /* Parse the status parameter...                                       */
  2554. /*---------------------------------------------------------------------*/
  2555.  rc = execute_set_on_off(word[0],&msgsts);
  2556.  if (rc != RC_OK)
  2557.    {
  2558. #ifdef TRACE
  2559.     trace_return();
  2560. #endif
  2561.     return(rc);
  2562.    }
  2563. /*---------------------------------------------------------------------*/
  2564. /* ... only "ON" is allowed...                                         */
  2565. /*---------------------------------------------------------------------*/
  2566.  if (!msgsts)
  2567.    {
  2568.     display_error(1,word[0],FALSE);
  2569. #ifdef TRACE
  2570.     trace_return();
  2571. #endif
  2572.     return(RC_INVALID_OPERAND);
  2573.    }
  2574. /*---------------------------------------------------------------------*/
  2575. /* Parse the position parameter...                                     */
  2576. /*---------------------------------------------------------------------*/
  2577.  if (num_params > 1)
  2578.    {
  2579.     rc = execute_set_row_position(word[1],&base,&off);
  2580.     if (rc != RC_OK)
  2581.       {
  2582. #ifdef TRACE
  2583.        trace_return();
  2584. #endif
  2585.        return(rc);
  2586.       }
  2587.    }
  2588. /*---------------------------------------------------------------------*/
  2589. /* Validate the number of lines parameter...                           */
  2590. /*---------------------------------------------------------------------*/
  2591.  if (num_params > 2)
  2592.    {
  2593.     num_lines = atoi(word[2]);
  2594.     if (num_lines < 1)
  2595.       {
  2596.        display_error(5,word[2],FALSE);
  2597. #ifdef TRACE
  2598.        trace_return();
  2599. #endif
  2600.        return(rc);
  2601.       }
  2602.    }
  2603.  else
  2604.    num_lines = 1;
  2605.  CURRENT_VIEW->msgline_base = (CHARTYPE)base;
  2606.  CURRENT_VIEW->msgline_off = off;
  2607.  CURRENT_VIEW->msgline_rows = num_lines;
  2608. #ifdef TRACE
  2609.  trace_return();
  2610. #endif
  2611.  return(rc);
  2612. }
  2613. /*man-start*********************************************************************
  2614. COMMAND
  2615.      msgmode - set display of messages on or off
  2616.  
  2617. SYNTAX
  2618.      [SET] MSGMode ON|OFF
  2619.  
  2620. DESCRIPTION
  2621.      The MSGMODE set command determines whether error messages will be 
  2622.      displayed or suppressed.
  2623.  
  2624. COMPATIBILITY
  2625.      XEDIT: Does not support [Short|Long] options.
  2626.      KEDIT: Compatible
  2627.  
  2628. DEFAULT
  2629.      ON
  2630.  
  2631. STATUS
  2632.      Complete
  2633. **man-end**********************************************************************/
  2634. #ifdef PROTO
  2635. short Msgmode(CHARTYPE *params)
  2636. #else
  2637. short Msgmode(params)
  2638. CHARTYPE *params;
  2639. #endif
  2640. /***********************************************************************/
  2641. {
  2642. /*-------------------------- external data ----------------------------*/
  2643. /*--------------------------- local data ------------------------------*/
  2644.  short rc=RC_OK;
  2645. /*--------------------------- processing ------------------------------*/
  2646. #ifdef TRACE
  2647.  trace_function("commset1.c:Msgmode");
  2648. #endif
  2649.  rc = execute_set_on_off(params,&CURRENT_VIEW->msgmode_status);
  2650. #ifdef TRACE
  2651.  trace_return();
  2652. #endif
  2653.  return(rc);
  2654. }
  2655. /*man-start*********************************************************************
  2656. COMMAND
  2657.      newlines - set position of cursor after adding blank line
  2658.  
  2659. SYNTAX
  2660.      [SET] NEWLines Aligned|Left
  2661.  
  2662. DESCRIPTION
  2663.      The NEWLINES set command determines where the cursor displays after
  2664.      a new line is added to the file.
  2665.      With ALIGNED, the cursor will display in the column of the new line
  2666.      immediately underneath the first non-blank character in the line
  2667.      above.
  2668.      With LEFT, the cursor will display in the first column of the new line.
  2669.  
  2670. COMPATIBILITY
  2671.      XEDIT: N/A
  2672.      KEDIT: Same command, different functionality.
  2673.  
  2674. DEFAULT
  2675.      ALIGNED
  2676.  
  2677. STATUS
  2678.      Complete
  2679. **man-end**********************************************************************/
  2680. #ifdef PROTO
  2681. short Newlines(CHARTYPE *params)
  2682. #else
  2683. short Newlines(params)
  2684. CHARTYPE *params;
  2685. #endif
  2686. /***********************************************************************/
  2687. {
  2688. /*-------------------------- external data ----------------------------*/
  2689. /*--------------------------- local data ------------------------------*/
  2690. #define NEW_PARAMS  1
  2691.  CHARTYPE parm[NEW_PARAMS];
  2692.  CHARTYPE *word[NEW_PARAMS+1];
  2693.  unsigned short num_params=0;
  2694. /*--------------------------- processing ------------------------------*/
  2695. #ifdef TRACE
  2696.  trace_function("commset1.c:Newlines");
  2697. #endif
  2698.  num_params = param_split(params,word,NEW_PARAMS,WORD_DELIMS,TEMP_PARAM);
  2699.  if (num_params > 1)
  2700.    {
  2701.     display_error(2,(CHARTYPE *)"",FALSE);
  2702. #ifdef TRACE
  2703.     trace_return();
  2704. #endif
  2705.     return(RC_INVALID_OPERAND);
  2706.    }
  2707.  if (num_params < 1)
  2708.    {
  2709.     display_error(3,(CHARTYPE *)"",FALSE);
  2710. #ifdef TRACE
  2711.     trace_return();
  2712. #endif
  2713.     return(RC_INVALID_OPERAND);
  2714.    }
  2715.  
  2716.  parm[0] = (CHARTYPE)UNDEFINED_OPERAND;
  2717.  if (equal((CHARTYPE *)"aligned",word[0],1))
  2718.     parm[0] = TRUE;
  2719.  if (equal((CHARTYPE *)"left",word[0],1))
  2720.     parm[0] = FALSE;
  2721.  if (parm[0] == (CHARTYPE)UNDEFINED_OPERAND)
  2722.    {
  2723.     display_error(1,word[0],FALSE);
  2724. #ifdef TRACE
  2725.     trace_return();
  2726. #endif
  2727.     return(RC_INVALID_OPERAND);
  2728.    }
  2729.  CURRENT_VIEW->newline_aligned = parm[0];
  2730. #ifdef TRACE
  2731.  trace_return();
  2732. #endif
  2733.  return(RC_OK);
  2734. }
  2735. /*man-start*********************************************************************
  2736. COMMAND
  2737.      nondisp - specify character to display for non-displaying characters
  2738.  
  2739. SYNTAX
  2740.      [SET] NONDisp char
  2741.  
  2742. DESCRIPTION
  2743.      The NONDISP command allows the user to change the character that 
  2744.      is displayed for non-displaying commands when [SET] ETMODE is OFF.
  2745.  
  2746. COMPATIBILITY
  2747.      XEDIT: Compatible.
  2748.      KEDIT: N/A
  2749.  
  2750. DEFAULT
  2751.      #
  2752.  
  2753. SEE ALSO
  2754.      SET ETMODE
  2755.  
  2756. STATUS
  2757.      Complete.
  2758. **man-end**********************************************************************/
  2759. #ifdef PROTO
  2760. short Nondisp(CHARTYPE *params)
  2761. #else
  2762. short Nondisp(params)
  2763. CHARTYPE *params;
  2764. #endif
  2765. /***********************************************************************/
  2766. {
  2767. /*-------------------------- external data ----------------------------*/
  2768.  extern bool NONDISPx;
  2769. /*--------------------------- local data ------------------------------*/
  2770. /*--------------------------- processing ------------------------------*/
  2771. #ifdef TRACE
  2772.  trace_function("commset1.c:Nondisp");
  2773. #endif
  2774.  if (strlen(params) != 1)
  2775.    {
  2776.     display_error(1,params,FALSE);
  2777. #ifdef TRACE
  2778.     trace_return();
  2779. #endif
  2780.     return(RC_INVALID_OPERAND);
  2781.    }
  2782.  NONDISPx = *params;
  2783.  build_current_screen(); 
  2784.  display_current_screen();
  2785. #ifdef TRACE
  2786.  trace_return();
  2787. #endif
  2788.  return(RC_OK);
  2789. }
  2790. /*man-start*********************************************************************
  2791. COMMAND
  2792.      number - turn prefix numbers on or off
  2793.  
  2794. SYNTAX
  2795.      [SET] NUMber ON|OFF
  2796.  
  2797. DESCRIPTION
  2798.      The NUMBER command allows the user to toggle the display of numbers
  2799.      in the prefix area.
  2800.  
  2801. COMPATIBILITY
  2802.      XEDIT: Compatible.
  2803.      KEDIT: Compatible.
  2804.  
  2805. DEFAULT
  2806.      ON
  2807.  
  2808. SEE ALSO
  2809.      SET PREFIX
  2810.  
  2811. STATUS
  2812.      Complete.
  2813. **man-end**********************************************************************/
  2814. #ifdef PROTO
  2815. short Number(CHARTYPE *params)
  2816. #else
  2817. short Number(params)
  2818. CHARTYPE *params;
  2819. #endif
  2820. /***********************************************************************/
  2821. {
  2822. /*-------------------------- external data ----------------------------*/
  2823. /*--------------------------- local data ------------------------------*/
  2824.  short rc=RC_OK;
  2825. /*--------------------------- processing ------------------------------*/
  2826. #ifdef TRACE
  2827.  trace_function("commset1.c:Number");
  2828. #endif
  2829.  rc = execute_set_on_off(params,&CURRENT_VIEW->number);
  2830.  if (rc == RC_OK)
  2831.    {
  2832.     build_current_screen(); 
  2833.     display_current_screen();
  2834.    }
  2835. #ifdef TRACE
  2836.  trace_return();
  2837. #endif
  2838.  return(rc);
  2839. }
  2840.